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:
soap.stores.com
goes toorigin1.com
towel.stores.com
goes toorigin2.com
Requirements
To use a custom origin server, you need to meet the following requirements:
- Your fallback proxy zone has an entitlement for Custom Origin Servers.
- Each custom origin needs to be a valid hostname with a proxied (orange-clouded) A, AAAA, or CNAME record in your account’s DNS. You cannot use an IP address.
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.
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:
-
Origin server name (default): Sets SNI to the custom origin
- If custom origin is
custom-origin.com
, then the SNI iscustom-origin.com
.
- If custom origin is
-
Host header: Sets SNI to the host header (or a host header override)
- If wildcards are not enabled and the hostname is
example.com
, then the SNI isexample.com
. - If wildcards are enabled, the hostname is
example.com
, and a request comes towww.example.com
, then the SNI iswww.example.com
.
- If wildcards are not enabled and the hostname is
-
Subdomain of zone: Choose what to set as the SNI value (custom hostname or any subdomain)
- If wildcards are not enabled and a request comes to
example.com
, choose whether to set the SNI asexample.com
orwww.example.com
. - If wildcards are enabled, you set the SNI to
example.com
, and a request comes towww.example.com
, then the SNI isexample.com
.
- If wildcards are not enabled and a request comes to
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:
- Custom origin name (default): Applies if you do not set the parameter
- Host header: Specify
":request_host_header:"
- Subdomain of zone: Set to
"example.com"
or another subdomain of the custom hostname