INTEGRITY Cloudflare Docs

Custom origin server

A custom origin server lets you send traffic from one or more custom hostnames to somewhere besides your default proxy fallback, such as:

Requirements

To use a custom origin server, you need to meet the following requirements:

Use a custom origin

To use a custom origin, select that option when creating a new custom hostname in the dashboard or include the "custom_origin_server": your_custom_origin_server parameter when using the API POST command.

Cloud provider origins (Azure, AWS, GCP)

When using a cloud provider endpoint as a custom origin (for example, Azure App Service, AWS ALB, or GCP Cloud Run), the provider may reject requests with a 404 or 400 error if the Host header does not match a domain configured on that endpoint.

By default, Cloudflare sends the original custom hostname as the Host header. If your cloud provider expects a different hostname:

  1. Configure the cloud provider to accept the custom hostname as a valid domain, or
  2. Use an Origin Rule to override the Host header to match the hostname your cloud provider expects.

SNI rewrites

When Cloudflare establishes a connection to your default origin server, the Host header and SNI will both be the value of the original custom hostname.

However, if you configure that custom hostname with a custom origin, the value of the SNI will be that of the custom origin and the Host header will be the original custom hostname. Since these values will not match, you will not be able to use the Full (strict) on your origins.

To solve this problem, you can contact your account team to request an entitlement for SNI rewrites.

SNI rewrite options

Choose how your custom hostname populates the SNI value with SNI rewrites:

Set an SNI rewrite

To set an SNI rewrite in the dashboard, choose your preferred option from Origin SNI value when creating a custom hostname.

To set an SNI rewrite via the API, set the custom_origin_sni parameter when creating a custom hostname: