How to add a custom domain to a function
Each function comes with an automatically generated domain on which it is available. However, it is possible to assign your own domain name to make it easier to use your functions.
You may need certain IAM permissions to carry out some actions described on this page. This means:
- Add a CNAME record pointing to your function’s default URL from the domains dashboard.
- Click the Endpoints tab on your Function’s Overview page.
- Click + Add endpoint.
- Enter your custom domain URL and validate the form.
- Connect to your function using your custom domain once the CNAME and TLS fields are validated by the Console.
Custom Domains do not support websockets. If you need to use websockets, you must configure them with the original container URL.
If you are using Cloudflare DNS to configure your custom domain, you must set the
CNAME record’s proxy status to DNS Only while adding it to your function. We perform a number of validation checks on our side when configuring your domain, and if the
CNAME record is proxied during these checks, the checks will fail.
Once you have configured your domain and your function is responding correctly, you can set the
CNAME record back to
Proxied if you wish.
The Cloudflare documentation on Proxy Status describes how to change the Proxy Status of a
CNAME record via the Cloudflare web UI.