You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -66,66 +66,6 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID`
66
66
67
67
</Details>
68
68
69
-
<Detailsheader="Example: Add a rule that overrides the resolved DNS record and the `Host` header of incoming requests">
70
-
71
-
The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single origin rule — overriding the resolved DNS record and the `Host` header of incoming requests — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated.
summary: Create an origin rule to change the HTTP `Host` header.
3
+
summary: Create an origin rule to change the HTTP `Host` header and DNS record.
4
4
products:
5
5
- Origin Rules
6
-
title: Change the HTTP Host header
7
-
description: Create an origin rule to change the HTTP `Host` header.
6
+
title: Change the HTTP Host header and DNS record
7
+
description: Create an origin rule to change the HTTP `Host` header and the resolved DNS record.
8
8
---
9
9
10
10
import { Render, Tabs, TabItem, Example } from"~/components";
11
11
12
-
The following origin rule overrides the HTTP `Host` header to `eu_server.example.net` for all requests containing `/eu/` in their URI path.
12
+
The following origin rule overrides the HTTP `Host` header to `hr-server.example.com` for all requests with a URI path starting with `/hr-app/`. It also overrides the DNS record to the same hostname.
13
+
14
+
The `Host` header override only updates the header value; the DNS record override will handle the rerouting of incoming requests. For more information on these overrides, refer to [Available settings](/rules/origin-rules/features/).
Copy file name to clipboardExpand all lines: src/content/docs/rules/origin-rules/features.mdx
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,9 @@ A common use case for this functionality is when your content is hosted on a thi
20
20
21
21
:::note[Notes]
22
22
23
-
- An origin rule performing a Host header override will also update the Server Name Indication (SNI) value of the original request to the same value. To set an SNI value different from the Host header value, add an [SNI override](#server-name-indication-sni) in the same origin rule or create a separate origin rule for this purpose.
23
+
- In most situations, when you rewrite the HTTP `Host` header you also need to configure a [DNS record override](#dns-record). The `Host` header override only updates the header value; the DNS record override will handle the rerouting of the request.
24
+
25
+
- An origin rule performing a `Host` header override will also update the Server Name Indication (SNI) value of the original request to the same value. To set an SNI value different from the `Host` header value, add an [SNI override](#server-name-indication-sni) in the same origin rule or create a separate origin rule for this purpose.
24
26
25
27
- If you have configured load balancing through Cloudflare and you wish to override the HTTP `Host` header per origin or for a given monitor, refer to [Override HTTP Host headers](/load-balancing/additional-options/override-http-host-headers/) in the Load Balancing documentation for more information.
26
28
@@ -30,10 +32,9 @@ A common use case for this functionality is when your content is hosted on a thi
30
32
31
33
Allows you to override the Server Name Indication (SNI) [^1] value of a request. For more information, refer to [What is SNI (Server Name Indication)?](https://www.cloudflare.com/learning/ssl/what-is-sni/) in the Learning Center.
32
34
33
-
The new SNI value must be a valid hostname on the same Cloudflare account (possibly on a different zone).
34
-
35
35
:::note[Notes]
36
36
37
+
- The new SNI value must be a valid hostname on the same Cloudflare account (possibly on a different zone).
37
38
- Currently, you can only use a static value when overriding SNI.
38
39
- An SNI override will take precedence over [SNI rewrites of custom origins](/cloudflare-for-platforms/cloudflare-for-saas/start/advanced-settings/custom-origin/#sni-rewrites) when using Cloudflare for SaaS.
39
40
@@ -47,9 +48,13 @@ Allows you to override the resolved hostname of incoming requests. This function
47
48
48
49
A common use case is when you are serving an application from the URI (for example, `mydomain.com/app`). In this case, the `app` may be hosted on a different server or by a third party. A DNS record override allows you to redirect requests to this endpoint to the server for that third-party application.
49
50
50
-
You must specify a valid hostname in a DNS record override that is a hostname on the same Cloudflare account (possibly on a different zone).
51
+
:::note
52
+
53
+
- You must specify a valid hostname in a DNS record override that is a hostname on the same Cloudflare account (possibly on a different zone). You can [configure a DNS record](/dns/manage-dns-records/how-to/create-dns-records#create-dns-records) (a `CNAME`, `A`, or `AAAA` record) with a hostname pointing to a third-party hostname/IP address, either proxied by Cloudflare or not.
51
54
52
-
You can [configure a DNS record](/dns/manage-dns-records/how-to/create-dns-records#create-dns-records) (a `CNAME`, `A`, or `AAAA` record) with a hostname pointing to a third-party hostname/IP address, either proxied by Cloudflare or not.
55
+
- In most situations, when you configure a DNS record override you also need to configure a [`Host` header override](#host-header). The DNS record override handles the rerouting of the request; the `Host` header override updates the `Host` HTTP header value in the request. Defining a `Host` header override will also update the Server Name Indication (SNI) value of the original request to the same value. To set an SNI value different from the `Host` header value, add an [SNI override](#server-name-indication-sni) in the same origin rule or create a separate origin rule for this purpose.
56
+
57
+
:::
53
58
54
59
The following example DNS records configure a `resolve.example.com` hostname pointing to an external hostname and IP address using a `CNAME` record and an `A` record, respectively:
Copy file name to clipboardExpand all lines: src/content/docs/rules/origin-rules/parameters.mdx
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,6 @@ Create [different overrides](/rules/origin-rules/features/) by including differe
17
17
| DNS record override / Destination port override |[`origin` object](#dns-record-override-and-destination-port-override-parameters)|
18
18
19
19
:::note
20
-
21
20
The same origin rule can have different types of overrides. Refer to [Configuring several overrides in the same rule](#configuring-several-overrides-in-the-same-rule) for a syntax example.
The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single origin rule — overriding the `Host` header of incoming requests and the resolved DNS record — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated.
0 commit comments