Origin Rules
import { Render } from "~/components";
Origin Rules allow you to change the origin server that Cloudflare sends a request to, or modify how the request reaches that server. This is useful when you need to route specific requests to a different backend, such as a third-party service or a server on a non-standard port. You can perform the following overrides:
- Host header: Overrides the
Hostheader of incoming requests. - Server Name Indication (SNI): Overrides the Server Name Indication (SNI) value of incoming requests.
- DNS record: Overrides the resolved hostname of incoming requests, sending the request to a different origin server.
- Destination port: Overrides the resolved destination port of incoming requests.
Each origin rule includes a filter expression that defines which requests the overrides apply to (for example, matching on hostname, path, or other request properties).
<Render
file="snippets-alternative"
product="rules"
params={{ suffix: "and customized modifications" }}
/>
<Render file="rules-requirements" product="rules" params={{ sentenceIntro: "Origin Rules require" }} />
Rules templates
Availability
| Free | Pro | Business | Enterprise | |
|---|---|---|---|---|
| Availability | Yes | Yes | Yes | Yes |
| Number of rules | 10 | 25 | 50 | 300 |
| Override Host header | No | No | No | Yes |
| Override SNI | No | No | No | Yes |
| Override DNS records | No | No | No | Yes |
| Override destination port | Yes | Yes | Yes | Yes |
Execution order
Important remarks
If you override the hostname with an origin rule (via Host header override or DNS record override) and add a header override to your load balancer configuration, the origin rule will take precedence over the load balancer configuration.
Like Page Rules, an origin rule performing a Host header override will update the SNI value of the original request to the same value of the Host header. To set an SNI value different from the Host header override, add an SNI override in the same origin rule or create a separate origin rule for this purpose.
<Render file="troubleshoot-rules-with-trace" product="rules" params={{ rulesFeatureName: "origin rules" }} />
谢谢你的反馈!