diff --git a/src/content/docs/fundamentals/reference/policies-compliances/content-security-policies.mdx b/src/content/docs/fundamentals/reference/policies-compliances/content-security-policies.mdx index 2a6a8dc9ce02c0a..f268a4ebe1c0d15 100644 --- a/src/content/docs/fundamentals/reference/policies-compliances/content-security-policies.mdx +++ b/src/content/docs/fundamentals/reference/policies-compliances/content-security-policies.mdx @@ -28,19 +28,19 @@ Cloudflare does not: If you require the CSP headers to be changed or added, you can change them using some Cloudflare products: -- If your website is [proxied](/dns/proxy-status/) through Cloudflare, you can use a [Response Header Modification rule](/rules/transform/response-header-modification/) to replace or add CSP headers. +- If your website is [proxied](/dns/proxy-status/) through Cloudflare, you can use a [response header transform rule](/rules/transform/response-header-modification/) to replace or add CSP headers. - If your website is hosted using [Cloudflare Pages](/pages/), you can set a [`_headers file`](/pages/configuration/headers/) to modify or add CSP headers. ### Product requirements To use certain Cloudflare features, however, you may need to update the headers in your CSP: -| Feature(s) | Updated headers | -| ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | -| [Rocket Loader](/speed/optimization/content/rocket-loader/), [Mirage](/speed/optimization/images/mirage/) | `script-src 'self' ajax.cloudflare.com;` | -| [Cloudflare Apps](https://cloudflareapps.com/apps/developer/docs/getting-started), [Scrape Shield](/waf/tools/scrape-shield/) | `script-src 'self' 'unsafe-inline'` | -| [Web Analytics](/web-analytics/) | `script-src static.cloudflareinsights.com; connect-src cloudflareinsights.com` | +| Feature(s) | Updated headers | +| ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | +| [Rocket Loader](/speed/optimization/content/rocket-loader/), [Mirage](/speed/optimization/images/mirage/) | `script-src 'self' ajax.cloudflare.com;` | +| [Cloudflare Apps](https://cloudflareapps.com/apps/developer/docs/getting-started), [Scrape Shield](/waf/tools/scrape-shield/) | `script-src 'self' 'unsafe-inline'` | +| [Web Analytics](/web-analytics/) | `script-src static.cloudflareinsights.com; connect-src cloudflareinsights.com` | | [Bot products](/bots/) | Refer to [JavaScript detections and CSPs](/bots/additional-configurations/javascript-detections/#if-you-have-a-content-security-policy-csp). | -| [Page Shield](/page-shield/) | Refer to [Page Shield CSP Header format](/page-shield/reference/csp-header/). | -| [Zaraz](/zaraz/) | No updates required ([details](https://blog.cloudflare.com/cloudflare-zaraz-supports-csp/)). | -| [Turnstile](/turnstile/) | Refer to [Turnstile CSP](/turnstile/reference/content-security-policy/). | +| [Page Shield](/page-shield/) | Refer to [Page Shield CSP Header format](/page-shield/reference/csp-header/). | +| [Zaraz](/zaraz/) | No updates required ([details](https://blog.cloudflare.com/cloudflare-zaraz-supports-csp/)). | +| [Turnstile](/turnstile/) | Refer to [Turnstile CSP](/turnstile/reference/content-security-policy/). | diff --git a/src/content/docs/reference-architecture/diagrams/content-delivery/optimizing-image-delivery-with-cloudflare-image-resizing-and-r2.mdx b/src/content/docs/reference-architecture/diagrams/content-delivery/optimizing-image-delivery-with-cloudflare-image-resizing-and-r2.mdx index 891778dcfc1c614..af3b5fcf892b44d 100644 --- a/src/content/docs/reference-architecture/diagrams/content-delivery/optimizing-image-delivery-with-cloudflare-image-resizing-and-r2.mdx +++ b/src/content/docs/reference-architecture/diagrams/content-delivery/optimizing-image-delivery-with-cloudflare-image-resizing-and-r2.mdx @@ -50,5 +50,5 @@ https://www.mywebsite.com/cdn-cgi/image/width=80,quality=75/uploads/image.jpg - [Image Resizing Documentation](/images/transform-images/) - [Cloudflare R2 Developer Docs](/r2/) -- [Rewrite URL rules](/rules/transform/url-rewrite/) +- [URL Rewrite Rules](/rules/transform/url-rewrite/) - [Serverless image content management platform](/reference-architecture/diagrams/serverless/serverless-image-content-management/) diff --git a/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx b/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx index c50d6a8b96ff461..37917baf8414be7 100644 --- a/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx +++ b/src/content/docs/rules/cloud-connector/examples/route-images-to-s3.mdx @@ -15,7 +15,7 @@ To route requests to `/images` on your domain to an AWS S3 bucket: 4. Enter the bucket URL. You can structure the URL in two ways: - **Subdomain-style URL**: Set the hostname to `.s3.amazonaws.com`. In this case, your files should be organized in the root of the bucket, meaning the URI path will map directly to the file. For example, `https:///images/file.jpg` will map to `https://.s3.amazonaws.com/images/file.jpg`. - **URI path-style URL**: Set the hostname to `s3.amazonaws.com`. Here, your bucket must include a folder named `images`, and files should be placed inside this folder. The URI path will then include the bucket name, like `https:////images/file.jpg` mapping to `https://s3.amazonaws.com//images/file.jpg`. -5. _(Optional)_ Use the [Rewrite URL](/rules/transform/url-rewrite/) feature of [Transform Rules](/rules/transform/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/images` to `//images` to match the URI path-style URL structure. +5. _(Optional)_ Use [URL Rewrite Rules](/rules/transform/url-rewrite/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/images` to `//images` to match the URI path-style URL structure. 6. Select **Next** and enter a descriptive name like `Route images to S3` in **Cloud Connector name**. 7. Under **If**, select **Custom filter expression** and enter the following expression:
`http.request.full_uri wildcard "http*:///images/*"`
diff --git a/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx b/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx index 078a50728cfdb2c..30dc2eba8503e99 100644 --- a/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx +++ b/src/content/docs/rules/cloud-connector/examples/send-eu-visitors-to-gcs.mdx @@ -15,7 +15,7 @@ To route requests from visitors in the European Union to a Google Cloud Storage 4. Enter the bucket URL. You can structure the URL in two ways: - **Subdomain-style URL**: For `.storage.googleapis.com`, your files should be organized in the root of the bucket. For example, `https:///index.html` will map to `https://.storage.googleapis.com/index.html`. - **URI path-style URL**: If you set the hostname to `storage.googleapis.com`, your bucket must include folders corresponding to the intended URI paths. For example, if you want `https:///eu/index.html` to map to a file in your bucket, the file should be placed at `https://storage.googleapis.com//eu/index.html`. -5. _(Optional)_ Use the [Rewrite URL](/rules/transform/url-rewrite/) feature of [Transform Rules](/rules/transform/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/eu` to `/` to match the URI path-style URL structure. +5. _(Optional)_ Use [URL Rewrite Rules](/rules/transform/url-rewrite/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/eu` to `/` to match the URI path-style URL structure. 6. Select **Next** and enter a descriptive name like `Route EU visitors to GCP` in **Cloud Connector name**. 7. Under **If**, select **Custom filter expression** and enter the following expression: `(ip.src.is_in_european_union)`
diff --git a/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx b/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx index 7a62b0398f7e286..139768587347d16 100644 --- a/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx +++ b/src/content/docs/rules/cloud-connector/examples/serve-static-assets-from-azure.mdx @@ -14,7 +14,7 @@ To serve static assets from an Azure Blob Storage container: 3. Select **Microsoft Azure - Blob Storage** as your [cloud provider](/rules/cloud-connector/providers/). 4. Enter the bucket URL. Use the following URL structure: - **Subdomain-style URL**: Set the hostname to `.blob.core.windows.net`. In this case, your bucket should include a folder named `static-assets`, and files should be placed inside this folder. For example, `https:///static-assets/style.css` will map to `https://.blob.core.windows.net/static-assets/style.css`. -5. _(Optional)_ Use the [Rewrite URL](/rules/transform/url-rewrite/) feature of [Transform Rules](/rules/transform/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/static-assets` to `/my-pages-project/static-assets` to match the file structure of your object storage bucket. +5. _(Optional)_ Use [URL Rewrite Rules](/rules/transform/url-rewrite/) to adjust the URL structure. For example, you can [create a URL rewrite](/rules/transform/url-rewrite/create-dashboard/) that changes `/static-assets` to `/my-pages-project/static-assets` to match the file structure of your object storage bucket. 6. Click **Next** and enter a descriptive name like `Serve static assets from Azure` in **Cloud Connector name**. 7. Under **If**, select **Custom filter expression** and enter the following expression: `http.request.full_uri wildcard "http*:///static-assets/*"`
diff --git a/src/content/docs/rules/compression-rules/index.mdx b/src/content/docs/rules/compression-rules/index.mdx index d9a55931a23a7ad..bee347405e7ef46 100644 --- a/src/content/docs/rules/compression-rules/index.mdx +++ b/src/content/docs/rules/compression-rules/index.mdx @@ -55,5 +55,5 @@ The following fields are commonly used in expressions of compression rules: diff --git a/src/content/docs/rules/configuration-rules/index.mdx b/src/content/docs/rules/configuration-rules/index.mdx index 3c044eca00e70f2..b6d7f13eb6f136a 100644 --- a/src/content/docs/rules/configuration-rules/index.mdx +++ b/src/content/docs/rules/configuration-rules/index.mdx @@ -37,5 +37,5 @@ The number of available configuration rules varies according to your Cloudflare diff --git a/src/content/docs/rules/custom-errors/index.mdx b/src/content/docs/rules/custom-errors/index.mdx index 0fbdb287fcf0a76..6c524eefaf168c7 100644 --- a/src/content/docs/rules/custom-errors/index.mdx +++ b/src/content/docs/rules/custom-errors/index.mdx @@ -31,7 +31,7 @@ When a custom error rule is triggered, Cloudflare will replace the body with the Cloudflare will keep any existing HTTP response headers except for `Content-Type` and `Content-Length`. -Additionally, you can configure [HTTP response header modification rules](/rules/transform/response-header-modification/) for error responses to add, change, or remove HTTP headers from the response. +Additionally, you can configure [Response Header Transform Rules](/rules/transform/response-header-modification/) for error responses to add, change, or remove HTTP headers from the response. ## Availability diff --git a/src/content/docs/rules/origin-rules/tutorials/point-to-pages-with-custom-domain.mdx b/src/content/docs/rules/origin-rules/tutorials/point-to-pages-with-custom-domain.mdx index e0e7cce6ef65490..143111f9776c33e 100644 --- a/src/content/docs/rules/origin-rules/tutorials/point-to-pages-with-custom-domain.mdx +++ b/src/content/docs/rules/origin-rules/tutorials/point-to-pages-with-custom-domain.mdx @@ -80,9 +80,9 @@ Use a URL rewrite to remove the `/blog` segment from the URL path. 6. In **Then rewrite the path and/or query**, enter the following values under **Path**: - | Target path | Rewrite to | - | ----------- | ---------- | - | `blog/*` | `${1}` | + | Target path | Rewrite to | + | -------------- | ------------ | + | [`/`] `blog/*` | [`/`] `${1}` | 7. Select **Deploy**. diff --git a/src/content/docs/rules/origin-rules/tutorials/point-to-r2-bucket-with-custom-domain.mdx b/src/content/docs/rules/origin-rules/tutorials/point-to-r2-bucket-with-custom-domain.mdx index 876785db392a503..91bedc91a585301 100644 --- a/src/content/docs/rules/origin-rules/tutorials/point-to-r2-bucket-with-custom-domain.mdx +++ b/src/content/docs/rules/origin-rules/tutorials/point-to-r2-bucket-with-custom-domain.mdx @@ -83,9 +83,9 @@ Use a URL rewrite to remove the `/images` segment from the URL path. Cloudflare 6. In **Then rewrite the path and/or query**, enter the following values under **Path**: - | Target path | Rewrite to | - | ----------- | ---------- | - | `images/*` | `${1}` | + | Target path | Rewrite to | + | ---------------- | ------------ | + | [`/`] `images/*` | [`/`] `${1}` | 7. Select **Deploy**. diff --git a/src/content/docs/rules/reference/page-rules-migration.mdx b/src/content/docs/rules/reference/page-rules-migration.mdx index 534c0b2d0f29960..c0ff15103f10fca 100644 --- a/src/content/docs/rules/reference/page-rules-migration.mdx +++ b/src/content/docs/rules/reference/page-rules-migration.mdx @@ -62,7 +62,7 @@ becomes a **filter expression** such as: -[Single Redirects](/rules/url-forwarding/single-redirects/create-dashboard/) and [Rewrite URL](/rules/transform/url-rewrite/create-dashboard/) rules also offer a simplified view called **Wildcard pattern**, allowing you to specify URL patterns (`http*://example.com/*/downloads/*.txt*`) without specifying the full filter expression (`http.request.full_uri wildcard "http*://example.com/*/downloads/*.txt*"`). +[Single Redirects](/rules/url-forwarding/single-redirects/create-dashboard/) and [URL Rewrite Rules](/rules/transform/url-rewrite/create-dashboard/) also offer a simplified view called **Wildcard pattern**, allowing you to specify URL patterns (`http*://example.com/*/downloads/*.txt*`) without specifying the full filter expression (`http.request.full_uri wildcard "http*://example.com/*/downloads/*.txt*"`). ### Important considerations diff --git a/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx b/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx index aa8598fd8bfc7e7..c7705c72dcfa8fc 100644 --- a/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx +++ b/src/content/docs/rules/transform/examples/add-request-header-bot-score.mdx @@ -1,19 +1,17 @@ --- pcx_content_type: example -summary: Create a request header modification rule (part of Transform Rules) to - add a `X-Bot-Score` HTTP header to the request with the current bot score. +summary: Create a request header transform rule to add a `X-Bot-Score` HTTP header to the request with the current bot score. products: - Transform Rules operation: - Request modification title: Add a request header with the current bot score -description: Create a request header modification rule (part of Transform Rules) - to add a `X-Bot-Score` HTTP header to the request with the current bot score. +description: Create a request header transform rule to add a `X-Bot-Score` HTTP header to the request with the current bot score. --- import { Example } from "~/components"; -The following HTTP request header modification rule adds a header named `X-Bot-Score` with the current bot score to the request: +The following request header transform rule adds a header named `X-Bot-Score` with the current bot score to the HTTP request: diff --git a/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx b/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx index ee82f91ccebc526..2711616028d6ef1 100644 --- a/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx +++ b/src/content/docs/rules/transform/examples/add-request-header-static-value.mdx @@ -1,21 +1,21 @@ --- pcx_content_type: example -summary: Create a request header modification rule (part of Transform Rules) to - add an `X-Source` HTTP header to the request with a static value +summary: + Create a request header transform rule to add an `X-Source` HTTP header to the request with a static value (`Cloudflare`). products: - Transform Rules operation: - Request modification title: Add request header with a static value -description: Create a request header modification rule (part of Transform Rules) - to add an `X-Source` HTTP header to the request with a static value +description: + Create a request header transform rule to add an `X-Source` HTTP header to the request with a static value (`Cloudflare`). --- import { Example } from "~/components"; -The following HTTP request header modification rule adds a header named `X-Source` with a static value (`Cloudflare`) to the request: +The following request header transform rule adds a header named `X-Source` with a static value (`Cloudflare`) to the HTTP request: diff --git a/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx b/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx index 9399f9c68938b62..82523500ac6dad3 100644 --- a/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx +++ b/src/content/docs/rules/transform/examples/add-response-header-static-value.mdx @@ -1,21 +1,21 @@ --- pcx_content_type: example -summary: Create a response header modification rule (part of Transform Rules) to - add a `set-cookie` HTTP header to the response with a static value +summary: + Create a response header transform rule to add a `set-cookie` HTTP header to the response with a static value (`cookiename=value`). products: - Transform Rules operation: - Response modification title: Add a response header with a static value -description: Create a response header modification rule (part of Transform - Rules) to add a `set-cookie` HTTP header to the response with a static value +description: + Create a response header transform rule to add a `set-cookie` HTTP header to the response with a static value (`cookiename=value`). --- import { Example } from "~/components"; -The following HTTP response header modification rule adds a header named `set-cookie` with a static value (`cookiename=value`) to the response: +The following response header transform rule adds a header named `set-cookie` with a static value (`cookiename=value`) to the HTTP response: @@ -33,4 +33,4 @@ Selected operation under **Modify response header**: _Add_ -This rule would keep any existing `set-cookie` headers already present in the response. +This rule would keep any existing `set-cookie` headers already present in the HTTP response. diff --git a/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx b/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx index 0b571ce0e0502eb..bb18efef8ea0fca 100644 --- a/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx +++ b/src/content/docs/rules/transform/examples/normalize-encoded-slash.mdx @@ -1,12 +1,12 @@ --- pcx_content_type: example -summary: Create a rewrite URL rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`). +summary: Create a URL rewrite rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`). products: - Transform Rules operation: - Rewrite URL title: Normalize encoded slashes in URL path -description: Create a rewrite URL rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`). +description: Create a URL rewrite rule (part of Transform Rules) to normalize encoded forward slashes (`%2F`) in the request path to standard slashes (`/`). --- import { Example } from "~/components"; @@ -17,7 +17,7 @@ However, many origin servers **do** automatically decode `%2F` into `/` when pro ## How to normalize `%2F` -To normalize encoded forward slashes (`%2F`) to standard slashes (`/`) in the request path before [subsequent](/ruleset-engine/reference/phases-list/) rule evaluation, create a new rewrite URL rule and define a dynamic URL path rewrite using [`url_decode()`](/ruleset-engine/rules-language/functions/#url_decode) function: +To normalize encoded forward slashes (`%2F`) to standard slashes (`/`) in the request path before [subsequent](/ruleset-engine/reference/phases-list/) rule evaluation, create a new URL rewrite rule and define a dynamic URL path rewrite using [`url_decode()`](/ruleset-engine/rules-language/functions/#url_decode) function: @@ -27,7 +27,7 @@ Text in **Expression Editor**: (lower(raw.http.request.full_uri) wildcard "*%2f*") ``` -Text after **Path** > **Rewrite to...** > _Dynamic_: +Text after **Path** > **Rewrite to** > _Dynamic_: ```txt url_decode(http.request.uri.path) @@ -35,4 +35,4 @@ url_decode(http.request.uri.path) -This transformation ensures that `%2F` is always treated as `/` in the request path. This is particularly useful when setting up rules that depend on URL path matching, as it prevents discrepancies caused by differing normalization behaviors. \ No newline at end of file +This transformation ensures that `%2F` is always treated as `/` in the request path. This is particularly useful when setting up rules that depend on URL path matching, as it prevents discrepancies caused by differing normalization behaviors. diff --git a/src/content/docs/rules/transform/examples/remove-request-header.mdx b/src/content/docs/rules/transform/examples/remove-request-header.mdx index 48ad44b286f942c..1018fea175eea00 100644 --- a/src/content/docs/rules/transform/examples/remove-request-header.mdx +++ b/src/content/docs/rules/transform/examples/remove-request-header.mdx @@ -1,19 +1,17 @@ --- pcx_content_type: example -summary: Create a request header modification rule (part of Transform Rules) to - remove the `cf-connecting-ip` HTTP header from the request. +summary: Create a request header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the request. products: - Transform Rules operation: - Request modification title: Remove a request header -description: Create a request header modification rule (part of Transform Rules) - to remove the `cf-connecting-ip` HTTP header from the request. +description: Create a request header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the request. --- import { Example } from "~/components"; -The following HTTP request header modification rule removes the `cf-connecting-ip` header from the request: +The following request header transform rule removes the `cf-connecting-ip` header from the HTTP request: diff --git a/src/content/docs/rules/transform/examples/remove-response-header.mdx b/src/content/docs/rules/transform/examples/remove-response-header.mdx index 5d03e0b9939f262..d4ba427cd880418 100644 --- a/src/content/docs/rules/transform/examples/remove-response-header.mdx +++ b/src/content/docs/rules/transform/examples/remove-response-header.mdx @@ -1,19 +1,17 @@ --- pcx_content_type: example -summary: Create a response header modification rule (part of Transform Rules) to - remove the `cf-connecting-ip` HTTP header from the response. +summary: Create a response header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the response. products: - Transform Rules operation: - Response modification title: Remove a response header -description: Create a response header modification rule (part of Transform - Rules) to remove the `cf-connecting-ip` HTTP header from the response. +description: Create a response header transform rule (part of Transform Rules) to remove the `cf-connecting-ip` HTTP header from the response. --- import { Example } from "~/components"; -The following HTTP response header modification rule removes the `cf-connecting-ip` header from the response: +The following response header transform rule removes the `cf-connecting-ip` header from the HTTP response: diff --git a/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx b/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx index 5b085a8db235d8e..0ce7c7c678d1490 100644 --- a/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-archive-urls-new-format.mdx @@ -15,7 +15,7 @@ description: Create a transform rule to rewrite the URL format import { Example } from "~/components"; -To rewrite the URLs of a blog archive that follow the URL format `/posts/--
-` to the new format `/posts/<YYYY>/<MM>/<DD>/<TITLE>`, create the following rewrite URL rule: +To rewrite the URLs of a blog archive that follow the URL format `/posts/<YYYY>-<MM>-<DD>-<TITLE>` to the new format `/posts/<YYYY>/<MM>/<DD>/<TITLE>`, create the following URL rewrite rule: <Example> @@ -25,7 +25,7 @@ Text in **Expression Editor**: http.request.uri.path ~ "^/posts/[0-9]+-[0-9]+-[0-9]+-.*" ``` -Text after **Path** > **Rewrite to...** > _Dynamic_: +Text after **Path** > **Rewrite to** > _Dynamic_: ```txt regex_replace(http.request.uri.path, "^/posts/([0-9]+)-([0-9]+)-([0-9]+)-(.*)$", "/posts/${1}/${2}/${3}/${4}") diff --git a/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx b/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx index 41d6c1672a94a66..542ab03d8e2c5c5 100644 --- a/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-moved-section.mdx @@ -1,19 +1,19 @@ --- pcx_content_type: example -summary: Create a rewrite URL rule (part of Transform Rules) to rewrite +summary: Create a URL rewrite rule (part of Transform Rules) to rewrite everything under `/blog/<PATH>` to `/marketing/<PATH>`. products: - Transform Rules operation: - Rewrite URL title: Rewrite path of moved section of a website -description: Create a rewrite URL rule (part of Transform Rules) to rewrite +description: Create a URL rewrite rule (part of Transform Rules) to rewrite everything under `/blog/<PATH>` to `/marketing/<PATH>`. --- import { Example } from "~/components"; -To rewrite everything under `/blog/<PATH>` to `/marketing/<PATH>`, create a new rewrite URL rule and define a dynamic URL path rewrite using [wildcard pattern parameters](/rules/transform/url-rewrite/create-dashboard/#wildcard-pattern-parameters): +To rewrite everything under `/blog/<PATH>` to `/marketing/<PATH>`, create a new URL rewrite rule and define a dynamic URL path rewrite using [wildcard pattern parameters](/rules/transform/url-rewrite/create-dashboard/#wildcard-pattern-parameters): <Example> @@ -23,9 +23,10 @@ To rewrite everything under `/blog/<PATH>` to `/marketing/<PATH>`, create a new - **Request URL**: `https://<YOUR_HOSTNAME>/blog/*` **Then rewrite the path and/or query** -- **Target path**: `/blog/*` -- **Rewrite to**: `/marketing/${1}` + +- **Target path**: [`/`] `blog/*` +- **Rewrite to**: [`/`] `marketing/${1}` </Example> -Make sure to replace `<YOUR_HOSTNAME>` with your actual hostname and adjust the example paths according to your setup. \ No newline at end of file +Make sure to replace `<YOUR_HOSTNAME>` with your actual hostname and adjust the example paths according to your setup. diff --git a/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx b/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx index 3111e09025af89b..fa337fac8083e7f 100644 --- a/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-path-archived-posts.mdx @@ -1,19 +1,19 @@ --- pcx_content_type: example -summary: Create a rewrite URL rule (part of Transform Rules) to rewrite any +summary: Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/news/2012/...` URI paths to `/archive/news/2012/...`. products: - Transform Rules operation: - Rewrite URL title: Rewrite path of archived blog posts -description: Create a rewrite URL rule (part of Transform Rules) to rewrite any +description: Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/news/2012/...` URI paths to `/archive/news/2012/...`. --- import { Example } from "~/components"; -To rewrite all requests to `/news/2012/...` to `/archive/news/2012/...` you must add a reference to the content of the original URL. Create a new rewrite URL rule and define a dynamic URL path rewrite using [wildcard pattern parameters](/rules/transform/url-rewrite/create-dashboard/#wildcard-pattern-parameters): +To rewrite all requests to `/news/2012/...` to `/archive/news/2012/...` you must add a reference to the content of the original URL. Create a new URL rewrite rule and define a dynamic URL path rewrite using [wildcard pattern parameters](/rules/transform/url-rewrite/create-dashboard/#wildcard-pattern-parameters): <Example> @@ -23,9 +23,10 @@ To rewrite all requests to `/news/2012/...` to `/archive/news/2012/...` you must - **Request URL**: `https://<YOUR_HOSTNAME>/news/2012/*` **Then rewrite the path and/or query** -- **Target path**: `/news/2012/*` -- **Rewrite to**: `/archive/news/2012/${1}` + +- **Target path**: [`/`] `news/2012/*` +- **Rewrite to**: [`/`] `archive/news/2012/${1}` </Example> -Make sure to replace `<YOUR_HOSTNAME>` with your actual hostname and adjust the example paths according to your setup. \ No newline at end of file +Make sure to replace `<YOUR_HOSTNAME>` with your actual hostname and adjust the example paths according to your setup. diff --git a/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx b/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx index babe5d640833a2a..906c81f29624be9 100644 --- a/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-path-object-storage.mdx @@ -1,19 +1,19 @@ --- pcx_content_type: example -summary: Create a rewrite URL rule (part of Transform Rules) to remove +summary: Create a URL rewrite rule (part of Transform Rules) to remove `/files/` from URI paths before routing request to your object storage bucket. products: - Transform Rules operation: - Rewrite URL title: Rewrite path for object storage bucket -description: Create a rewrite URL rule (part of Transform Rules) to rewrite any +description: Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/files/...` URI paths to `/...`. --- import { Example } from "~/components"; -To remove `/files/` from URI paths before routing request to your object storage bucket, create a new rewrite URL rule and define a dynamic URL path rewrite using [wildcard pattern parameters](/rules/transform/url-rewrite/create-dashboard/#wildcard-pattern-parameters): +To remove `/files/` from URI paths before routing request to your object storage bucket, create a new URL rewrite rule and define a dynamic URL path rewrite using [wildcard pattern parameters](/rules/transform/url-rewrite/create-dashboard/#wildcard-pattern-parameters): <Example> @@ -23,10 +23,11 @@ To remove `/files/` from URI paths before routing request to your object storage - **Request URL**: `https://<YOUR_HOSTNAME>/files/*` **Then rewrite the path and/or query** -- **Target path**: `/files/*` -- **Rewrite to**: `/${1}` + +- **Target path**: [`/`] `files/*` +- **Rewrite to**: [`/`] `${1}` </Example> Make sure to replace `<YOUR_HOSTNAME>` with your actual hostname and adjust the example paths according to your setup. -Then, use [Cloud Connector](/rules/cloud-connector/) to route traffic to an object storage bucket. \ No newline at end of file +Then, use [Cloud Connector](/rules/cloud-connector/) to route traffic to an object storage bucket. diff --git a/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx b/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx index c392ee0d4f4a8e4..9bf5e59df6e07cb 100644 --- a/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-several-url-different-url.mdx @@ -1,19 +1,19 @@ --- pcx_content_type: example -summary: Create a rewrite URL rule (part of Transform Rules) to rewrite any +summary: Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/images/<FOLDER1>/<FOLDER2>/<FILENAME>` to `/img/<FILENAME>`. products: - Transform Rules operation: - Rewrite URL title: Rewrite image paths with several URL segments -description: Create a rewrite URL rule (part of Transform Rules) to rewrite any +description: Create a URL rewrite rule (part of Transform Rules) to rewrite any requests for `/images/<FOLDER1>/<FOLDER2>/<FILENAME>` to `/img/<FILENAME>`. --- import { Example } from "~/components"; -To rewrite paths like `/images/<FOLDER1>/<FOLDER2>/<FILENAME>` — where `<FOLDER1>`, `<FOLDER2>`, and `<FILENAME>` can vary — to `/img/<FILENAME>`, create a rewrite URL rule with a dynamic rewrite of the path component: +To rewrite paths like `/images/<FOLDER1>/<FOLDER2>/<FILENAME>` — where `<FOLDER1>`, `<FOLDER2>`, and `<FILENAME>` can vary — to `/img/<FILENAME>`, create a URL rewrite rule with a dynamic rewrite of the path component: <Example> @@ -23,7 +23,7 @@ Text in **Expression Editor**: http.request.uri.path ~ "^/images/[^/]+/[^/]+/[^/]+$" ``` -Text after **Path** > **Rewrite to...** > _Dynamic_: +Text after **Path** > **Rewrite to** > _Dynamic_: ```txt regex_replace(http.request.uri.path, "^/images/[^/]+/[^/]+/(.+)$", "/img/${1}") diff --git a/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx b/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx index 1d03267c391c14c..ae418a6c5ed5b0a 100644 --- a/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-url-string-visitors.mdx @@ -13,7 +13,7 @@ description: Create a transform rule to rewrite the request path from `/blog` to import { Example } from "~/components"; -To rewrite a request to the `/blog` path to `/blog?sort-by=date`, create a rewrite URL rule with the following settings: +To rewrite a request to the `/blog` path to `/blog?sort-by=date`, create a URL rewrite rule with the following settings: <Example> @@ -23,7 +23,7 @@ Text in **Expression Editor**: http.request.uri.path == "/blog" ``` -Text after **Query** > **Rewrite to...** > _Static_: +Text after **Query** > **Rewrite to** > _Static_: ```txt sort-by=date diff --git a/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx b/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx index d7871173e7c2a69..01e16d45bac3b9e 100644 --- a/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx +++ b/src/content/docs/rules/transform/examples/rewrite-welcome-for-countries.mdx @@ -1,21 +1,21 @@ --- pcx_content_type: example -summary: Create two rewrite URL rules (part of Transform Rules) to rewrite the +summary: Create two URL rewrite rules (part of Transform Rules) to rewrite the path of the welcome page for visitors in specific countries. products: - Transform Rules operation: - Rewrite URL title: Rewrite page path for visitors in specific countries -description: Create two rewrite URL rules (part of Transform Rules) to rewrite +description: Create two URL rewrite rules (part of Transform Rules) to rewrite the path of the welcome page for visitors in specific countries. --- import { Example } from "~/components"; -To have a welcome page in two languages, create two rewrite URL rules with a static rewrite of the path component: +To have a welcome page in two languages, create two URL rewrite rules with a static rewrite of the path component: -**Rewrite URL rule #1** +**URL rewrite rule #1** <Example> @@ -25,7 +25,7 @@ Text in **Expression Editor**: http.request.uri.path == "/welcome.html" && ip.src.country == "GB" ``` -Text after **Path** > **Rewrite to...** > _Static_: +Text after **Path** > **Rewrite to** > _Static_: ```txt /welcome-gb.html @@ -33,7 +33,7 @@ Text after **Path** > **Rewrite to...** > _Static_: </Example> -**Rewrite URL rule #2** +**URL rewrite rule #2** <Example> @@ -43,7 +43,7 @@ Text in **Expression Editor**: http.request.uri.path == "/welcome.html" && ip.src.country == "PT" ``` -Text after **Path** > **Rewrite to...** > _Static_: +Text after **Path** > **Rewrite to** > _Static_: ```txt /welcome-pt.html diff --git a/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx b/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx index 3a9d276a97cda09..d9224c55fb83a6f 100644 --- a/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx +++ b/src/content/docs/rules/transform/examples/set-response-header-bot-score.mdx @@ -1,20 +1,19 @@ --- pcx_content_type: example -summary: Create a response header modification rule (part of Transform Rules) to +summary: Create a response header transform rule (part of Transform Rules) to set an `X-Bot-Score` HTTP header in the response with the current bot score. products: - Transform Rules operation: - Response modification title: Set a response header with the current bot score -description: Create a response header modification rule (part of Transform - Rules) to set an `X-Bot-Score` HTTP header in the response with the current - bot score. +description: Create a response header transform rule (part of Transform Rules) + to set an `X-Bot-Score` HTTP header in the response with the current bot score. --- import { Example } from "~/components"; -The following HTTP response header modification rule sets a header named `X-Bot-Score` to the current bot score in the response: +The following response header transform rule sets a header named `X-Bot-Score` to the current bot score in the HTTP response: <Example> @@ -32,4 +31,4 @@ Selected operation under **Modify response header**: _Set dynamic_ </Example> -This rule would overwrite any existing `X-Bot-Score` headers already present in the response. +This rule would overwrite any existing `X-Bot-Score` headers already present in the HTTP response. diff --git a/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx b/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx index 2816db6428b0450..c76a4834c13df2f 100644 --- a/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx +++ b/src/content/docs/rules/transform/examples/set-response-header-static-value.mdx @@ -1,21 +1,20 @@ --- pcx_content_type: example -summary: Create a response header modification rule (part of Transform Rules) to - set an `X-Bot-Score` HTTP header in the response to a static value - (`Cloudflare`). +summary: Create a response header transform rule (part of Transform Rules) to + set an `X-Bot-Score` HTTP header in the response to a static value (`Cloudflare`). products: - Transform Rules operation: - Response modification title: Set response header with a static value -description: Create a response header modification rule (part of Transform - Rules) to set an `X-Bot-Score` HTTP header in the response to a static value - (`Cloudflare`). +description: + Create a response header transform rule (part of Transform Rules) to + set an `X-Bot-Score` HTTP header in the response to a static value (`Cloudflare`). --- import { Example } from "~/components"; -The following HTTP response header modification rule sets a header named `X-Source` to a static value (`Cloudflare`) in the response: +The following response header transform rule sets a header named `X-Source` to a static value (`Cloudflare`) in the HTTP response: <Example> @@ -33,4 +32,4 @@ Selected operation under **Modify response header**: _Set static_ </Example> -This rule would overwrite any existing `X-Source` headers already present in the response. +This rule would overwrite any existing `X-Source` headers already present in the HTTP response. diff --git a/src/content/docs/rules/transform/index.mdx b/src/content/docs/rules/transform/index.mdx index 9231691462a45b7..56d7db947d9cfb0 100644 --- a/src/content/docs/rules/transform/index.mdx +++ b/src/content/docs/rules/transform/index.mdx @@ -11,13 +11,11 @@ Transform Rules allow you to adjust the URI path, query string, and HTTP headers There are several types of Transform Rules: -- [**Rewrite URL rules**](/rules/transform/url-rewrite/): Rewrite the URL path and query string of an HTTP request. -- [**HTTP request header modification rules**](/rules/transform/request-header-modification/): Set the value of an HTTP request header or remove a request header. -- [**HTTP response header modification rules**](/rules/transform/response-header-modification/): Set the value of an HTTP response header or remove a response header. +- [**URL Rewrite Rules**](/rules/transform/url-rewrite/): Rewrite the URL path and query string of an HTTP request. +- [**Request Header Transform Rules**](/rules/transform/request-header-modification/): Set the value of an HTTP request header or remove a request header. +- [**Response Header Transform Rules**](/rules/transform/response-header-modification/): Set the value of an HTTP response header or remove a response header. - [**Managed Transforms**](/rules/transform/managed-transforms/): Perform common adjustments to HTTP request and response headers with the click of a button. -To configure Transform Rules in the dashboard, go to the **Transform Rules** page in Rules. - <Render file="snippets-alternative" params={{ suffix: "header modifications and rewrite logic" }} @@ -35,9 +33,9 @@ To configure Transform Rules in the dashboard, go to the **Transform Rules** pag Alternatively, create a transform rule from scratch in the dashboard or via Cloudflare API. Refer to the following sections for detailed instructions: -- [Rewrite URL rules](/rules/transform/url-rewrite/) -- [HTTP request header modification rules](/rules/transform/request-header-modification/) -- [HTTP response header modification rules](/rules/transform/response-header-modification/create-dashboard/) +- [URL Rewrite Rules](/rules/transform/url-rewrite/) +- [Request Header Transform Rules](/rules/transform/request-header-modification/) +- [Response Header Transform Rules](/rules/transform/response-header-modification/) - [Managed Transforms](/rules/transform/managed-transforms/) For Terraform examples, refer to [Transform Rules configuration using Terraform](/terraform/additional-configurations/transform-rules/). @@ -60,8 +58,8 @@ A Cloudflare user must have the [Firewall role](/fundamentals/setup/manage-membe Managed Transforms run before other types of Transform Rules that modify HTTP headers: -- Managed Transforms that adjust HTTP request headers run before HTTP request header modification rules. -- Managed Transforms that adjust HTTP response headers run before HTTP response header modification rules. +- Managed Transforms that adjust HTTP request headers run before Request Header Transform Rules. +- Managed Transforms that adjust HTTP response headers run before Response Header Transform Rules. Transform Rules run in order. Rules that appear later in the list of Transform Rules can overwrite changes done by previous rules. You can define the rule order in the dashboard or via API. diff --git a/src/content/docs/rules/transform/request-header-modification/create-api.mdx b/src/content/docs/rules/transform/request-header-modification/create-api.mdx index 26ffd5ee76796e0..27980f23fe5603d 100644 --- a/src/content/docs/rules/transform/request-header-modification/create-api.mdx +++ b/src/content/docs/rules/transform/request-header-modification/create-api.mdx @@ -1,21 +1,19 @@ --- -title: Create a rule via API +title: Create a request header transform rule via API pcx_content_type: how-to type: overview sidebar: order: 3 -head: - - tag: title - content: Create an HTTP request header modification rule via API + label: Create a rule via API --- import { Details, Render, APIRequest } from "~/components"; -Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create HTTP request header modification rules via API. Refer to the [Rules examples gallery](/rules/transform/examples/?operation=Request+modification) for common use cases. +Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create Request Header Transform Rules via API. Refer to the [Rules examples gallery](/rules/transform/examples/?operation=Request+modification) for common use cases. ## Basic rule settings -When creating an HTTP request header modification rule via API, make sure you: +When creating a request header transform rule via API, make sure you: - Set the rule action to `rewrite`. - Define the [header modification parameters](/rules/transform/request-header-modification/reference/parameters/) in the `action_parameters` field according to the operation to perform (set or remove header). @@ -26,7 +24,7 @@ When creating an HTTP request header modification rule via API, make sure you: <Render file="rules-creation-workflow" params={{ - ruleName: "an HTTP request header modification rule", + ruleName: "a request header transform rule", phaseName: "http_request_late_transform", }} /> @@ -37,7 +35,7 @@ Make sure your API token has the [required permissions](#required-api-token-perm <Details header="Example: Add an HTTP request header with a static value"> -The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP request header modification rule — adding an HTTP request header with a static value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single request header transform rule — adding an HTTP request header with a static value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -46,7 +44,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP request header modification rule", + description: "My first request header transform rule", action: "rewrite", action_parameters: { headers: { @@ -83,7 +81,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP request header modification rule", + "description": "My first request header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -101,7 +99,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` <Details header="Example: Add an HTTP request header with a dynamic value"> -The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP request header modification rule — adding an HTTP request header with a dynamic value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single request header transform rule — adding an HTTP request header with a dynamic value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -110,7 +108,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP request header modification rule", + description: "My first request header transform rule", action: "rewrite", action_parameters: { headers: { @@ -147,7 +145,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP request header modification rule", + "description": "My first request header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -165,7 +163,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` <Details header="Example: Remove an HTTP request header"> -The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP request header modification rule — removing an HTTP request header — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/). The response will contain the complete definition of the ruleset you updated. +The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single request header transform rule — removing an HTTP request header — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/). The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -174,7 +172,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP request header modification rule", + description: "My first request header transform rule", action: "rewrite", action_parameters: { headers: { @@ -209,7 +207,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP request header modification rule", + "description": "My first request header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -229,7 +227,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` ## Required API token permissions -The API token used in API requests to manage HTTP request header modification rules must have at least the following permissions: +The API token used in API requests to manage Request Header Transform Rules must have at least the following permissions: - _Transform Rules_ > _Edit_ - _Account Rulesets_ > _Read_ diff --git a/src/content/docs/rules/transform/request-header-modification/create-dashboard.mdx b/src/content/docs/rules/transform/request-header-modification/create-dashboard.mdx index 4346e1d52ecdae0..f54933d42cc8431 100644 --- a/src/content/docs/rules/transform/request-header-modification/create-dashboard.mdx +++ b/src/content/docs/rules/transform/request-header-modification/create-dashboard.mdx @@ -1,11 +1,9 @@ --- -title: Create a rule in the dashboard +title: Create a request header transform rule in the dashboard pcx_content_type: how-to sidebar: order: 2 -head: - - tag: title - content: Create an HTTP request header modification rule in the dashboard + label: Create a rule in the dashboard --- import { Render } from "~/components"; diff --git a/src/content/docs/rules/transform/request-header-modification/index.mdx b/src/content/docs/rules/transform/request-header-modification/index.mdx index 7f16dd49e7c2dd0..25f098d84ffcc55 100644 --- a/src/content/docs/rules/transform/request-header-modification/index.mdx +++ b/src/content/docs/rules/transform/request-header-modification/index.mdx @@ -1,22 +1,21 @@ --- -title: Modify request header +title: Request Header Transform Rules pcx_content_type: concept sidebar: order: 2 -head: - - tag: title - content: HTTP request header modification rules + group: + label: Modify request headers description: Learn how to modify HTTP request headers with Cloudflare's rules. --- import { Render } from "~/components"; -Use HTTP request header modification rules to manipulate the headers of HTTP requests sent to your origin server. +Use Request Header Transform Rules to manipulate the headers of HTTP requests sent to your origin server. ```mermaid flowchart LR accTitle: Header modifications diagram -accDescr: Header modification rules can change the headers sent to your origin server (request header modifications) or sent your your website visitors (response header modifications). +accDescr: Header transform rules can change the headers sent to your origin server (request header modifications) or sent your your website visitors (response header modifications). A[Visitor] B((Cloudflare)) @@ -33,15 +32,15 @@ linkStyle 1 stroke-width: 3px <br /> -To modify HTTP headers in the **response** sent to website visitors, refer to [HTTP response header modification rules](/rules/transform/response-header-modification/). +To modify HTTP headers in the **response** sent to website visitors, refer to [Response Header Transform Rules](/rules/transform/response-header-modification/). -Through HTTP request header modification rules you can: +Through Request Header Transform Rules you can: - Set the value of an HTTP request header to a literal string value, overwriting its previous value or adding a new header to the request. - Set the value of an HTTP request header according to an expression, overwriting its previous value or adding a new header to the request. - Remove an HTTP header from the request. -You can create an HTTP request header modification rule [in the dashboard](/rules/transform/request-header-modification/create-dashboard/) or [via API](/rules/transform/request-header-modification/create-api/). +You can create a request header transform rule [in the dashboard](/rules/transform/request-header-modification/create-dashboard/), [via API](/rules/transform/request-header-modification/create-api/), or [using Terraform](/terraform/additional-configurations/transform-rules/#create-a-request-header-transform-rule). <Render file="snippets-alternative" @@ -52,7 +51,7 @@ You can create an HTTP request header modification rule [in the dashboard](/rule - You cannot modify or remove HTTP request headers whose name starts with `x-cf-` or `cf-` except for the `cf-connecting-ip` HTTP request header, which you can remove. -- Due to protocol compliance reasons, modifying or removing request headers with [forbidden header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name) (such as `Accept-Encoding`) is generally not allowed in request header modification rules. +- Due to protocol compliance reasons, modifying or removing request headers with [forbidden header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name) (such as `Accept-Encoding`) is generally not allowed in Request Header Transform Rules. - You cannot modify the value of any header commonly used to identify the website visitor's IP address, such as `x-forwarded-for`, `true-client-ip`, or `x-real-ip`. Additionally, you cannot remove the `x-forwarded-for` header. @@ -68,5 +67,5 @@ You can create an HTTP request header modification rule [in the dashboard](/rule <Render file="troubleshoot-rules-with-trace" - params={{ rulesFeatureName: "HTTP request header modification rules" }} + params={{ rulesFeatureName: "Request Header Transform Rules" }} /> diff --git a/src/content/docs/rules/transform/request-header-modification/link-create-terraform.mdx b/src/content/docs/rules/transform/request-header-modification/link-create-terraform.mdx index b632b39d3a2f90d..e433db6b42d5869 100644 --- a/src/content/docs/rules/transform/request-header-modification/link-create-terraform.mdx +++ b/src/content/docs/rules/transform/request-header-modification/link-create-terraform.mdx @@ -1,7 +1,7 @@ --- pcx_content_type: navigation title: Create a rule using Terraform -external_link: /terraform/additional-configurations/transform-rules/#create-an-http-request-header-modification-rule +external_link: /terraform/additional-configurations/transform-rules/#create-a-request-header-transform-rule sidebar: order: 4 --- diff --git a/src/content/docs/rules/transform/request-header-modification/reference/fields-functions.mdx b/src/content/docs/rules/transform/request-header-modification/reference/fields-functions.mdx index 5701034295be2de..c85a5b8a278a6f9 100644 --- a/src/content/docs/rules/transform/request-header-modification/reference/fields-functions.mdx +++ b/src/content/docs/rules/transform/request-header-modification/reference/fields-functions.mdx @@ -5,11 +5,10 @@ sidebar: order: 3 head: - tag: title - content: Available fields and functions for HTTP request header modification - + content: Available fields and functions | Request Header Transform Rules --- -import { Render } from "~/components" +import { Render } from "~/components"; The available fields when setting an HTTP request header value using an expression are the following: diff --git a/src/content/docs/rules/transform/request-header-modification/reference/header-format.mdx b/src/content/docs/rules/transform/request-header-modification/reference/header-format.mdx index 9c78f8a3d096f81..adf3f63ff91f14f 100644 --- a/src/content/docs/rules/transform/request-header-modification/reference/header-format.mdx +++ b/src/content/docs/rules/transform/request-header-modification/reference/header-format.mdx @@ -1,15 +1,12 @@ --- -title: Format of header names and values +title: Format of HTTP request header names and values pcx_content_type: reference sidebar: order: 2 -head: - - tag: title - content: Format of HTTP request header names and values - + label: Format of header names and values --- -import { Render } from "~/components" +import { Render } from "~/components"; The **name** of the HTTP request header you want to set or remove can only contain: diff --git a/src/content/docs/rules/transform/request-header-modification/reference/index.mdx b/src/content/docs/rules/transform/request-header-modification/reference/index.mdx index 51500344628306a..5da742efceaee57 100644 --- a/src/content/docs/rules/transform/request-header-modification/reference/index.mdx +++ b/src/content/docs/rules/transform/request-header-modification/reference/index.mdx @@ -7,11 +7,11 @@ sidebar: hideIndex: true head: - tag: title - content: Request header modification rules reference + content: Reference | Request Header Transform Rules --- import { DirectoryListing } from "~/components"; -This section contains reference information on HTTP request header modification rules. +This section contains reference information for Request Header Transform Rules. <DirectoryListing /> diff --git a/src/content/docs/rules/transform/request-header-modification/reference/parameters.mdx b/src/content/docs/rules/transform/request-header-modification/reference/parameters.mdx index cb05c8fd2ddde37..5de521730f110d5 100644 --- a/src/content/docs/rules/transform/request-header-modification/reference/parameters.mdx +++ b/src/content/docs/rules/transform/request-header-modification/reference/parameters.mdx @@ -5,23 +5,22 @@ sidebar: order: 4 head: - tag: title - content: Request header modification API parameter reference - + content: API parameter reference | Request Header Transform Rules --- To set an HTTP request header via API, set the following parameters in the `action_parameters` field: -* **operation**: `set` -* Include one of the following parameters to define a static or dynamic value: +- **operation**: `set` +- Include one of the following parameters to define a static or dynamic value: - * **value**: Specifies a static value for the HTTP request header. - * **expression**: Specifies the expression that defines a value for the HTTP request header. + - **value**: Specifies a static value for the HTTP request header. + - **expression**: Specifies the expression that defines a value for the HTTP request header. To remove an HTTP request header via API, set the following parameter in the `action_parameters` field: -* **operation**: `remove` +- **operation**: `remove` -For step-by-step instructions, refer to [Create an HTTP request header modification rule via API](/rules/transform/request-header-modification/create-api/). +For step-by-step instructions, refer to [Create a request header transform rule via API](/rules/transform/request-header-modification/create-api/). ## Static header value parameters @@ -54,11 +53,7 @@ The full syntax of the `action_parameters` field to define a dynamic HTTP reques ``` :::note - - Check the [available fields and functions](/rules/transform/request-header-modification/reference/fields-functions/) you can use in an expression. - - ::: ## Header removal parameters diff --git a/src/content/docs/rules/transform/response-header-modification/create-api.mdx b/src/content/docs/rules/transform/response-header-modification/create-api.mdx index bedb2915a9a143f..ba191b7516fc829 100644 --- a/src/content/docs/rules/transform/response-header-modification/create-api.mdx +++ b/src/content/docs/rules/transform/response-header-modification/create-api.mdx @@ -1,20 +1,18 @@ --- -title: Create a rule via API +title: Create a response header transform rule via API pcx_content_type: how-to sidebar: order: 3 -head: - - tag: title - content: Create an HTTP response header modification rule via API + label: Create a rule via API --- import { Details, Render, APIRequest } from "~/components"; -Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create HTTP response header modification rules via API. Refer to the [Rules examples gallery](/rules/transform/examples/?operation=Response+modification) for common use cases. +Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create Response Header Transform Rules via API. Refer to the [Rules examples gallery](/rules/transform/examples/?operation=Response+modification) for common use cases. ## Basic rule settings -When creating an HTTP response header modification rule via API, make sure you: +When creating a response header transform rule via API, make sure you: - Set the rule action to `rewrite`. - Define the [header modification parameters](/rules/transform/request-header-modification/reference/parameters/) in the `action_parameters` field according to the operation to perform (set, add, or remove header). @@ -25,7 +23,7 @@ When creating an HTTP response header modification rule via API, make sure you: <Render file="rules-creation-workflow" params={{ - ruleName: "an HTTP response header modification rule", + ruleName: "a response header transform rule", phaseName: "http_response_headers_transform", }} /> @@ -36,7 +34,7 @@ Make sure your API token has the [required permissions](#required-api-token-perm <Details header="Example: Set an HTTP response header to a static value"> -The following example configures the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP response header modification rule — setting an HTTP response header to a static value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example configures the rules of an existing phase ruleset (`$RULESET_ID`) to a single response header transform rule — setting an HTTP response header to a static value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -45,7 +43,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP response header modification rule", + description: "My first response header transform rule", action: "rewrite", action_parameters: { headers: { @@ -65,7 +63,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES "result": { "id": "<RULESET_ID>", "name": "Zone-level Response Headers Transform Ruleset", - "description": "Zone-level ruleset that will execute Response Header Modification Rules.", + "description": "Zone-level ruleset that will execute Response Header Transform Rules.", "kind": "zone", "version": "2", "rules": [ @@ -82,7 +80,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP response header modification rule", + "description": "My first response header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -100,7 +98,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES <Details header="Example: Set an HTTP response header to a dynamic value"> -The following example configures the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP response header modification rule — setting an HTTP response header to a dynamic value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example configures the rules of an existing phase ruleset (`$RULESET_ID`) to a single response header transform rule — setting an HTTP response header to a dynamic value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -109,7 +107,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP response header modification rule", + description: "My first response header transform rule", action: "rewrite", action_parameters: { headers: { @@ -129,7 +127,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES "result": { "id": "<RULESET_ID>", "name": "Zone-level Response Headers Transform Ruleset", - "description": "Zone-level ruleset that will execute Response Header Modification Rules.", + "description": "Zone-level ruleset that will execute Response Header Transform Rules.", "kind": "zone", "version": "2", "rules": [ @@ -146,7 +144,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP response header modification rule", + "description": "My first response header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -164,7 +162,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES <Details header="Example: Add a `set-cookie` HTTP response header with a static value"> -The following example configures the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP response header modification rule — adding a `set-cookie` HTTP response header with a static value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. By configuring the rule with the `add` operation you will keep any existing `set-cookie` headers that may already exist in the response. The response will contain the complete definition of the ruleset you updated. +The following example configures the rules of an existing phase ruleset (`$RULESET_ID`) to a single response header transform rule — adding a `set-cookie` HTTP response header with a static value — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. By configuring the rule with the `add` operation you will keep any existing `set-cookie` headers that may already exist in the response. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -173,7 +171,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP response header modification rule", + description: "My first response header transform rule", action: "rewrite", action_parameters: { headers: { @@ -193,7 +191,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES "result": { "id": "<RULESET_ID>", "name": "Zone-level Response Headers Transform Ruleset", - "description": "Zone-level ruleset that will execute Response Header Modification Rules.", + "description": "Zone-level ruleset that will execute Response Header Transform Rules.", "kind": "zone", "version": "2", "rules": [ @@ -210,7 +208,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP response header modification rule", + "description": "My first response header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -228,7 +226,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES <Details header="Example: Remove an HTTP response header"> -The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single HTTP response header modification rule — removing an HTTP response header — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single response header transform rule — removing an HTTP response header — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -237,7 +235,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` rules: [ { expression: '(starts_with(http.request.uri.path, "/en/"))', - description: "My first HTTP response header modification rule", + description: "My first response header transform rule", action: "rewrite", action_parameters: { headers: { @@ -256,7 +254,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "result": { "id": "<RULESET_ID>", "name": "Zone-level Response Headers Transform Ruleset", - "description": "Zone-level ruleset that will execute Response Header Modification Rules.", + "description": "Zone-level ruleset that will execute Response Header Transform Rules.", "kind": "zone", "version": "2", "rules": [ @@ -272,7 +270,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } }, "expression": "(starts_with(http.request.uri.path, \"/en/\"))", - "description": "My first HTTP response header modification rule", + "description": "My first response header transform rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -292,7 +290,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` ## Required API token permissions -The API token used in API requests to manage HTTP response header modification rules must have at least the following permissions: +The API token used in API requests to manage Response Header Transform Rules must have at least the following permissions: - _Transform Rules_ > _Edit_ - _Account Rulesets_ > _Read_ diff --git a/src/content/docs/rules/transform/response-header-modification/create-dashboard.mdx b/src/content/docs/rules/transform/response-header-modification/create-dashboard.mdx index d4e60c2858a001e..0625d300a27d7e5 100644 --- a/src/content/docs/rules/transform/response-header-modification/create-dashboard.mdx +++ b/src/content/docs/rules/transform/response-header-modification/create-dashboard.mdx @@ -1,11 +1,9 @@ --- -title: Create a rule in the dashboard +title: Create a response header transform rule in the dashboard pcx_content_type: how-to sidebar: order: 2 -head: - - tag: title - content: Create an HTTP response header modification rule in the dashboard + label: Create a rule in the dashboard --- import { Render } from "~/components"; diff --git a/src/content/docs/rules/transform/response-header-modification/index.mdx b/src/content/docs/rules/transform/response-header-modification/index.mdx index 4ddd37cf1fe369a..96eb41ef499b8c7 100644 --- a/src/content/docs/rules/transform/response-header-modification/index.mdx +++ b/src/content/docs/rules/transform/response-header-modification/index.mdx @@ -1,21 +1,20 @@ --- -title: Modify response header +title: Response Header Transform Rules pcx_content_type: concept sidebar: order: 3 -head: - - tag: title - content: HTTP response header modification rules + group: + label: Modify response headers --- import { Render } from "~/components"; -Use HTTP response header modification rules to manipulate the headers of HTTP responses sent to website visitors. +Use Response Header Transform Rules to manipulate the headers of HTTP responses sent to website visitors. ```mermaid flowchart LR accTitle: Header modifications diagram -accDescr: Header modification rules can change the headers sent to your origin server (request header modifications) or sent your your website visitors (response header modifications). +accDescr: Header transform rules can change the headers sent to your origin server (request header modifications) or sent your your website visitors (response header modifications). A[Visitor] B((Cloudflare)) @@ -32,22 +31,21 @@ linkStyle 3 stroke-width: 3px <br /> -To modify HTTP headers in the **request** sent to your origin server, refer to [HTTP request header modification rules](/rules/transform/request-header-modification/). +To modify HTTP headers in the **request** sent to your origin server, refer to [Request Header Transform Rules](/rules/transform/request-header-modification/). -Through HTTP response header modification rules you can: +Through Response Header Transform Rules you can: - Set the value of an HTTP response header to a literal string value, overwriting its previous value or adding a new header to the response if it does not exist. - Set the value of an HTTP response header according to an expression, overwriting its previous value or adding a new header to the response if it does not exist. - Add a new HTTP response header with a literal string value without removing any existing headers with the same name. - Remove an HTTP header from the response. -You can create an HTTP response header modification rule [in the dashboard](/rules/transform/response-header-modification/create-dashboard/) or [via API](/rules/transform/response-header-modification/create-api/). +You can create a response header transform rule [in the dashboard](/rules/transform/response-header-modification/create-dashboard/), [via API](/rules/transform/response-header-modification/create-api/), or [using Terraform](/terraform/additional-configurations/transform-rules/#create-a-response-header-transform-rule). <Render file="snippets-alternative" params={{ suffix: "response header modifications" }} /> -<br /> ## Important remarks @@ -57,7 +55,7 @@ You can create an HTTP response header modification rule [in the dashboard](/rul - You cannot modify the value of certain headers such as `server`, `eh-cache-tag`, or `eh-cdn-cache-control`. -- Currently you cannot reference [IP lists](/waf/tools/lists/custom-lists/#lists-with-ip-addresses-ip-lists) in expressions of HTTP response header modification rules. +- Currently you cannot reference [IP lists](/waf/tools/lists/custom-lists/#lists-with-ip-addresses-ip-lists) in expressions of Response Header Transform Rules. - The HTTP response header removal operation will remove all response headers with the provided name. @@ -75,5 +73,5 @@ You can create an HTTP response header modification rule [in the dashboard](/rul <Render file="troubleshoot-rules-with-trace" - params={{ rulesFeatureName: "HTTP response header modification rules" }} + params={{ rulesFeatureName: "Response Header Transform Rules" }} /> diff --git a/src/content/docs/rules/transform/response-header-modification/link-create-terraform.mdx b/src/content/docs/rules/transform/response-header-modification/link-create-terraform.mdx index 541f35f923a0ad9..862079303fe75d1 100644 --- a/src/content/docs/rules/transform/response-header-modification/link-create-terraform.mdx +++ b/src/content/docs/rules/transform/response-header-modification/link-create-terraform.mdx @@ -1,7 +1,7 @@ --- pcx_content_type: navigation title: Create a rule using Terraform -external_link: /terraform/additional-configurations/transform-rules/#create-an-http-response-header-modification-rule +external_link: /terraform/additional-configurations/transform-rules/#create-a-response-header-transform-rule sidebar: order: 4 --- diff --git a/src/content/docs/rules/transform/response-header-modification/reference/fields-functions.mdx b/src/content/docs/rules/transform/response-header-modification/reference/fields-functions.mdx index 58d129dc68b4ad0..4dd91e12a87e532 100644 --- a/src/content/docs/rules/transform/response-header-modification/reference/fields-functions.mdx +++ b/src/content/docs/rules/transform/response-header-modification/reference/fields-functions.mdx @@ -5,11 +5,10 @@ sidebar: order: 3 head: - tag: title - content: Available fields and functions for HTTP response header modification - + content: Available fields and functions | Response Header Transform Rules --- -import { Render } from "~/components" +import { Render } from "~/components"; The available fields when setting an HTTP response header value using an expression are the following: diff --git a/src/content/docs/rules/transform/response-header-modification/reference/header-format.mdx b/src/content/docs/rules/transform/response-header-modification/reference/header-format.mdx index 650d663eff1325e..d29fd92147336d9 100644 --- a/src/content/docs/rules/transform/response-header-modification/reference/header-format.mdx +++ b/src/content/docs/rules/transform/response-header-modification/reference/header-format.mdx @@ -1,15 +1,12 @@ --- -title: Format of header names and values +title: Format of HTTP response header names and values pcx_content_type: reference sidebar: order: 2 -head: - - tag: title - content: Format of HTTP response header names and values - + label: Format of header names and values --- -import { Render } from "~/components" +import { Render } from "~/components"; The **name** of the HTTP response header you want to set or remove can only contain: diff --git a/src/content/docs/rules/transform/response-header-modification/reference/index.mdx b/src/content/docs/rules/transform/response-header-modification/reference/index.mdx index 15f9291a529673a..0728caa478e7419 100644 --- a/src/content/docs/rules/transform/response-header-modification/reference/index.mdx +++ b/src/content/docs/rules/transform/response-header-modification/reference/index.mdx @@ -7,11 +7,11 @@ sidebar: hideIndex: true head: - tag: title - content: Response Header Modification Rules reference + content: Reference | Response Header Transform Rules --- import { DirectoryListing } from "~/components"; -This section contains reference information on HTTP Response Header Modification Rules. +This section contains reference information for Response Header Transform Rules. <DirectoryListing /> diff --git a/src/content/docs/rules/transform/response-header-modification/reference/parameters.mdx b/src/content/docs/rules/transform/response-header-modification/reference/parameters.mdx index c4a1a9c4b3f145b..41d82016ed54bc0 100644 --- a/src/content/docs/rules/transform/response-header-modification/reference/parameters.mdx +++ b/src/content/docs/rules/transform/response-header-modification/reference/parameters.mdx @@ -5,26 +5,25 @@ sidebar: order: 4 head: - tag: title - content: Response header modification API parameter reference - + content: API parameter reference | Response Header Transform Rules --- To set an HTTP response header, overwriting any headers with the same name, use the following parameters in the `action_parameters` field: -* **operation**: `set` -* Include one of the following parameters to define a static or dynamic value: +- **operation**: `set` +- Include one of the following parameters to define a static or dynamic value: - * **value**: Specifies a static value for the HTTP response header. - * **expression**: Specifies the expression that defines a value for the HTTP response header. + - **value**: Specifies a static value for the HTTP response header. + - **expression**: Specifies the expression that defines a value for the HTTP response header. To add an HTTP response header, keeping any existing headers with the same name, use the following parameters in the `action_parameters` field: -* **operation**: `add` -* **value**: Specifies a static value for the HTTP response header. +- **operation**: `add` +- **value**: Specifies a static value for the HTTP response header. To remove an HTTP response header, set the following parameter in the `action_parameters` field: -* **operation**: `remove` +- **operation**: `remove` ## Static header value parameters @@ -57,11 +56,7 @@ The full syntax of the `action_parameters` field to define a dynamic HTTP respon ``` :::note - - Check the [available fields and functions](/rules/transform/request-header-modification/reference/fields-functions/) you can use in an expression. - - ::: ## Header removal parameters diff --git a/src/content/docs/rules/transform/troubleshooting.mdx b/src/content/docs/rules/transform/troubleshooting.mdx index 505eea8ae4aa01e..8d679de7c4ec19f 100644 --- a/src/content/docs/rules/transform/troubleshooting.mdx +++ b/src/content/docs/rules/transform/troubleshooting.mdx @@ -16,6 +16,6 @@ For more information on runtime errors related to Transform Rules configuration, Transform Rules performing request header modifications affect the HTTP headers sent by Cloudflare's network to your origin server. You will not find these headers in your browser request or response data, which can make it difficult to tell if the rule is working as intended. -To check if a request header modification is taking effect, you can check the logs on your origin server or use [Cloudflare Trace](/fundamentals/trace-request/) to check that the rule is matching traffic correctly. Since [Cloudflare Logpush](/logs/about/) only logs original request/response headers, Logpush logs will not include any header transformations done via Transform Rules. +To check if a request header transform rule is taking effect, you can check the logs on your origin server or use [Cloudflare Trace](/fundamentals/trace-request/) to check that the rule is matching traffic correctly. Since [Cloudflare Logpush](/logs/about/) only logs original HTTP request/response headers, Logpush logs will not include any header transformations done via Transform Rules. To add HTTP headers that website visitors will receive in their browsers, you must [modify the response headers](/rules/transform/response-header-modification/) instead. diff --git a/src/content/docs/rules/transform/url-rewrite/create-api.mdx b/src/content/docs/rules/transform/url-rewrite/create-api.mdx index 7e1e7be68e7fd6d..de1c39b50aea1da 100644 --- a/src/content/docs/rules/transform/url-rewrite/create-api.mdx +++ b/src/content/docs/rules/transform/url-rewrite/create-api.mdx @@ -1,20 +1,18 @@ --- -title: Create a rule via API +title: Create a URL rewrite rule via API pcx_content_type: how-to sidebar: order: 3 -head: - - tag: title - content: Create a rewrite URL rule via API + label: Create a rule via API --- import { Details, Render, APIRequest } from "~/components"; -Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create rewrite URL rules via API. Refer to the [Rules examples gallery](/rules/transform/examples/?operation=Rewrite+URL) for common use cases. +Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create URL Rewrite Rules via API. Refer to the [Rules examples gallery](/rules/transform/examples/?operation=Rewrite+URL) for common use cases. ## Basic rule settings -When creating a rewrite URL rule via API, make sure you: +When creating a URL rewrite rule via API, make sure you: - Set the rule action to `rewrite`. - Define the [URL rewrite parameters](/rules/transform/url-rewrite/reference/parameters/#api-information) in the `action_parameters` field according to the type of URL rewrite (static or dynamic). @@ -25,7 +23,7 @@ When creating a rewrite URL rule via API, make sure you: <Render file="rules-creation-workflow" params={{ - ruleName: "a rewrite URL rule", + ruleName: "a URL rewrite rule", phaseName: "http_request_transform", }} /> @@ -36,7 +34,7 @@ Make sure your API token has the [required permissions](#required-api-token-perm <Details header="Example: Add a rule that performs a static URL rewrite"> -The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single rewrite URL rule — performing a static rewrite of the URI path — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single URL rewrite rule — performing a static rewrite of the URI path — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -45,7 +43,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` rules: [ { expression: '(http.request.uri.query contains "eu")', - description: "My first static rewrite URL rule", + description: "My first static URL rewrite rule", action: "rewrite", action_parameters: { uri: { @@ -80,7 +78,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } }, "expression": "(http.request.uri.query contains \"eu\")", - "description": "My first static rewrite URL rule", + "description": "My first static URL rewrite rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -98,7 +96,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` <Details header="Example: Add a rule that performs a dynamic URL rewrite"> -The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single rewrite URL rule — performing a dynamic rewrite of the URI path — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. +The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single URL rewrite rule — performing a dynamic rewrite of the URI path — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. <APIRequest path="/zones/{zone_id}/rulesets/{ruleset_id}" @@ -107,7 +105,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` rules: [ { expression: 'starts_with(http.request.uri.path, "/news/2012/")', - description: "My first dynamic rewrite URL rule", + description: "My first dynamic URL rewrite rule", action: "rewrite", action_parameters: { uri: { @@ -142,7 +140,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } }, "expression": "starts_with(http.request.uri.path, \"/news/2012/\")", - "description": "My first dynamic rewrite URL rule", + "description": "My first dynamic URL rewrite rule", "last_updated": "2021-04-14T14:42:04.219025Z", "ref": "<RULE_REF>" } @@ -162,7 +160,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` ## Required API token permissions -The API token used in API requests to manage rewrite URL rules must have at least the following permissions: +The API token used in API requests to manage URL Rewrite Rules must have at least the following permissions: - _Account_ > _Transform Rules_ > _Edit_ - _Account_ > _Account Rulesets_ > _Read_ diff --git a/src/content/docs/rules/transform/url-rewrite/create-dashboard.mdx b/src/content/docs/rules/transform/url-rewrite/create-dashboard.mdx index a70b26f79866ce6..5b99b91be98465b 100644 --- a/src/content/docs/rules/transform/url-rewrite/create-dashboard.mdx +++ b/src/content/docs/rules/transform/url-rewrite/create-dashboard.mdx @@ -1,11 +1,9 @@ --- -title: Create a rule in the dashboard +title: Create a URL rewrite rule in the dashboard pcx_content_type: how-to sidebar: order: 2 -head: - - tag: title - content: Create a rewrite URL rule in the dashboard + label: Create a rule in the dashboard --- import { Render } from "~/components"; @@ -24,7 +22,7 @@ To create a rule: 5. Enter a descriptive name for the rule in **Rule name**. - ![The rewrite URL rule creation page in the Cloudflare dashboard.](~/assets/images/rules/transform/create-url-rewrite-rule.png) + ![The URL rewrite rule creation page in the Cloudflare dashboard.](~/assets/images/rules/transform/create-url-rewrite-rule.png) 6. Under **If incoming requests match**, select one of the following options: @@ -33,12 +31,12 @@ To create a rule: - **Custom filter expression**: The rule will only apply to traffic matching a custom expression. Define the [rule expression](/ruleset-engine/rules-language/expressions/edit-expressions/) to configure which requests should be rewritten. Use either the Expression Builder or the Expression Editor to define the custom expression. For more information, refer to [Edit expressions in the dashboard](/ruleset-engine/rules-language/expressions/edit-expressions/). :::note - Check the [fields and functions](/rules/transform/url-rewrite/reference/fields-functions/) you can use in filter expressions of rewrite URL rules. + Check the [fields and functions](/rules/transform/url-rewrite/reference/fields-functions/) you can use in filter expressions of URL rewrite rules. ::: - **All incoming requests**: The rule will apply to all traffic. -7. (Optional) Define the action for your rewrite URL rule by selecting one of the available options displayed as radio buttons, and then a value from the drop-down list, depending on the action: +7. (Optional) Define the action for your URL rewrite rule by selecting one of the available options displayed as radio buttons, and then a value from the drop-down list, depending on the action: - If you select **Rewrite to** > _Static_, enter the string that will replace the original URL path (or query string). For example, enter `welcome-gb.html` to rewrite the original URL path to `/welcome-gb.html`. @@ -72,6 +70,6 @@ Refer to [URL rewrite parameters](/rules/transform/url-rewrite/reference/paramet The **Request URL** value is only used to match the incoming request with a rule. It will not be used for capturing URL patterns for rewrites. If you are matching the URL path or query string in **Target path** or **Target query**, respectively, make sure that the **Request URL** pattern also matches the incoming request, or else the rule will not trigger. -To validate rewrite URL rule matches, use [Cloudflare Trace](/fundamentals/trace-request/). To validate rewritten URLs, check your origin server. +To validate URL rewrite rule matches, use [Cloudflare Trace](/fundamentals/trace-request/). To validate rewritten URLs, check your origin server. ::: diff --git a/src/content/docs/rules/transform/url-rewrite/index.mdx b/src/content/docs/rules/transform/url-rewrite/index.mdx index faa17dc5a8dbbb0..224e0045d0881cc 100644 --- a/src/content/docs/rules/transform/url-rewrite/index.mdx +++ b/src/content/docs/rules/transform/url-rewrite/index.mdx @@ -1,26 +1,25 @@ --- pcx_content_type: concept -title: Rewrite URL +title: URL Rewrite Rules sidebar: order: 1 -head: - - tag: title - content: Rewrite URL rules + group: + label: Rewrite URLs --- import { Render } from "~/components"; You can manipulate the URL of a request through different operations, namely rewrites and redirects: -- **URL rewrite**: A server-side operation that converts a source URL into a target URL. It occurs before a web server has fully processed a request. A rewrite is not visible to website visitors, since the URL displayed in the browser does not change. Configure rewrite URL rules to perform rewrites on the Cloudflare global network without reaching your web server. +- **URL rewrite**: A server-side operation that converts a source URL into a target URL. It occurs before a web server has fully processed a request. A rewrite is not visible to website visitors, since the URL displayed in the browser does not change. Configure URL Rewrite Rules to perform rewrites on the Cloudflare global network without reaching your web server. - **URL redirect**: A client-side operation that converts a source URL into a target URL. It occurs after the web server has loaded the initial URL. In this case, a website visitor can notice the URL changing when the redirect occurs. Refer to [Redirects](/rules/url-forwarding/) to learn more about configuring redirects. -Use a URL rewrite to return the content of a URL while displaying a different URL in the browser. You can rewrite the URI path, the query string, or both. +Use a URL rewrite rule to return the content of a URL while displaying a different URL in the browser. You can rewrite the URI path, the query string, or both. :::caution -You cannot rewrite the hostname using a rewrite URL rule. To rewrite the hostname, use an [origin rule](/rules/origin-rules/features/#dns-record). +You cannot rewrite the hostname using a URL rewrite rule. To rewrite the hostname, use an [origin rule](/rules/origin-rules/features/#dns-record). <Render file="snippets-alternative" params={{ suffix: "rewrite logic" }} /> @@ -28,18 +27,18 @@ You cannot rewrite the hostname using a rewrite URL rule. To rewrite the hostnam ## Static and dynamic rewrites -Rewrite URL rules can perform static or dynamic rewrites: +URL Rewrite Rules can perform static or dynamic rewrites: - **Static rewrite**: Replaces a given part of a request URL (path or query string) with a static string. - **Dynamic rewrite**: Supports more advanced scenarios where you use a rewrite expression to define the resulting path or query string. -Create rewrite URL rules [in the dashboard](/rules/transform/url-rewrite/create-dashboard/), [via Cloudflare API](/rules/transform/url-rewrite/create-api/), or [using Terraform](/terraform/additional-configurations/transform-rules/#create-a-rewrite-url-rule). +Create URL Rewrite Rules [in the dashboard](/rules/transform/url-rewrite/create-dashboard/), [via Cloudflare API](/rules/transform/url-rewrite/create-api/), or [using Terraform](/terraform/additional-configurations/transform-rules/#create-a-url-rewrite-rule). ## Serve images from custom paths -When using Cloudflare Images, you can use URL rewrites to serve images from a custom path. For more information, refer to [Serve images from custom domains](/images/manage-images/serve-images/serve-from-custom-domains/). +When using Cloudflare Images, you can use URL Rewrite Rules to serve images from a custom path. For more information, refer to [Serve images from custom domains](/images/manage-images/serve-images/serve-from-custom-domains/). <Render file="troubleshoot-rules-with-trace" - params={{ rulesFeatureName: "URL rewrites" }} + params={{ rulesFeatureName: "URL Rewrite Rules" }} /> diff --git a/src/content/docs/rules/transform/url-rewrite/link-create-terraform.mdx b/src/content/docs/rules/transform/url-rewrite/link-create-terraform.mdx index d1dd96c8e7f671c..7f387adb48c3692 100644 --- a/src/content/docs/rules/transform/url-rewrite/link-create-terraform.mdx +++ b/src/content/docs/rules/transform/url-rewrite/link-create-terraform.mdx @@ -1,7 +1,7 @@ --- pcx_content_type: navigation title: Create a rule using Terraform -external_link: /terraform/additional-configurations/transform-rules/#create-a-rewrite-url-rule +external_link: /terraform/additional-configurations/transform-rules/#create-a-url-rewrite-rule sidebar: order: 4 --- diff --git a/src/content/docs/rules/transform/url-rewrite/reference/fields-functions.mdx b/src/content/docs/rules/transform/url-rewrite/reference/fields-functions.mdx index e0770b369667fce..2356744fdaf8f11 100644 --- a/src/content/docs/rules/transform/url-rewrite/reference/fields-functions.mdx +++ b/src/content/docs/rules/transform/url-rewrite/reference/fields-functions.mdx @@ -5,14 +5,14 @@ sidebar: order: 3 head: - tag: title - content: Available fields and functions in rewrite URL rules + content: Available fields and functions | URL Rewrite Rules --- import { Render } from "~/components"; ## Filter expressions -A rewrite URL rule [filter expression](/ruleset-engine/rules-language/expressions/) (that is, the expression that defines which incoming requests match the rule) can include the following fields: +A URL rewrite rule [filter expression](/ruleset-engine/rules-language/expressions/) (that is, the expression that defines which incoming requests match the rule) can include the following fields: <Render file="transform/transform-phase-fields" /> diff --git a/src/content/docs/rules/transform/url-rewrite/reference/index.mdx b/src/content/docs/rules/transform/url-rewrite/reference/index.mdx index 33d06c5385242c3..dde914911b1761c 100644 --- a/src/content/docs/rules/transform/url-rewrite/reference/index.mdx +++ b/src/content/docs/rules/transform/url-rewrite/reference/index.mdx @@ -7,11 +7,11 @@ sidebar: hideIndex: true head: - tag: title - content: Rewrite URL rules reference + content: Reference | URL Rewrite Rules --- import { DirectoryListing } from "~/components"; -This section contains reference information for rewrite URL rules. +This section contains reference information for URL Rewrite Rules. <DirectoryListing /> diff --git a/src/content/docs/rules/transform/url-rewrite/reference/parameters.mdx b/src/content/docs/rules/transform/url-rewrite/reference/parameters.mdx index 08662c3b81469c8..6ad2c37c584345a 100644 --- a/src/content/docs/rules/transform/url-rewrite/reference/parameters.mdx +++ b/src/content/docs/rules/transform/url-rewrite/reference/parameters.mdx @@ -18,7 +18,7 @@ The maximum length of all parameter values in a URL rewrite (combined) is 4,096 ### Static URL rewrites -The full syntax of the `action_parameters` field for a static rewrite URL rule that rewrites both the URI path and the query string is the following: +The full syntax of the `action_parameters` field for a static URL rewrite rule that rewrites both the URI path and the query string is the following: ```json "action_parameters": { @@ -37,7 +37,7 @@ If you are only rewriting the URI path or the query string, omit the `query` or ### Dynamic URL rewrites -The full syntax of the `action_parameters` field for a dynamic rewrite URL rule that rewrites both the URI path and the query string is the following: +The full syntax of the `action_parameters` field for a dynamic URL rewrite rule that rewrites both the URI path and the query string is the following: ```json "action_parameters": { @@ -56,7 +56,7 @@ If you are only rewriting the URI path or the query string, omit the `query` or #### Wildcard matching and replacement -The syntax of a dynamic rewrite URL rule that rewrites both the URI path and the query string based on wildcard matching and replacement is the following: +The syntax of a dynamic URL rewrite rule that rewrites both the URI path and the query string based on wildcard matching and replacement is the following: ```json { diff --git a/src/content/docs/ruleset-engine/about/rules.mdx b/src/content/docs/ruleset-engine/about/rules.mdx index 0df9d9fa048fd9f..8c9f88f1de3f887 100644 --- a/src/content/docs/ruleset-engine/about/rules.mdx +++ b/src/content/docs/ruleset-engine/about/rules.mdx @@ -37,11 +37,10 @@ While evaluating rules for a given request/response, the values of all request a For example: -- If a [rewrite URL rule](/rules/transform/url-rewrite/) #1 updates the URI path or the query string of a request, rewrite URL rule #2 will not take these earlier changes into consideration. -- If an [HTTP request header modification rule](/rules/transform/request-header-modification/) #1 sets the value of a request header, HTTP request header modification rule #2 will not be able to read or evaluate this new value. -- If a rewrite URL rule updates the URI path or query string of a request, the `http.request.uri`, `http.request.uri.*`, and `http.request.full_uri` fields will have a different value in phases after the `http_request_transform` phase (where rewrite URL rules are executed). +- If a [URL rewrite rule](/rules/transform/url-rewrite/) #1 updates the URI path or the query string of a request, URL rewrite rule #2 will not take these earlier changes into consideration. +- If a [request header transform rule](/rules/transform/request-header-modification/) #1 sets the value of an HTTP request header, request header transform rule #2 will not be able to read or evaluate this new value. +- If a URL rewrite rule updates the URI path or query string of a request, the `http.request.uri`, `http.request.uri.*`, and `http.request.full_uri` fields will have a different value in phases after the `http_request_transform` phase (where URL Rewrite Rules are executed). :::note - If you want to use the original field values in rules evaluated later, you can use raw fields (for example, `raw.http.request.uri.path`) in their expressions. These special fields are immutable during the entire request evaluation workflow. For a list of raw fields, refer to the [Fields reference](/ruleset-engine/rules-language/fields/reference/?field-category=Raw+fields). ::: diff --git a/src/content/docs/ruleset-engine/reference/phases-list.mdx b/src/content/docs/ruleset-engine/reference/phases-list.mdx index 905e76882797baf..1a7e68954753801 100644 --- a/src/content/docs/ruleset-engine/reference/phases-list.mdx +++ b/src/content/docs/ruleset-engine/reference/phases-list.mdx @@ -28,28 +28,28 @@ The following tables list the [phases](/ruleset-engine/about/phases/) of Cloudfl The phases execute in the order they appear in the table. -| Phase name | Used in product/feature | -| ------------------------------- | --------------------------------------------------------------------------------------- | -| `http_request_sanitize` | [URL normalization](/rules/normalization/) | -| `http_request_dynamic_redirect` | [Single Redirects](/rules/url-forwarding/single-redirects/) | -| `http_request_transform` | [Rewrite URL Rules](/rules/transform/url-rewrite/) | -| _N/A_ (internal phase) | [Waiting Room Rules](/waiting-room/additional-options/waiting-room-rules/) | -| `http_config_settings` | [Configuration Rules](/rules/configuration-rules/) | -| `http_request_origin` | [Origin Rules](/rules/origin-rules/) | -| `ddos_l7`\* | [HTTP DDoS Attack Protection](/ddos-protection/managed-rulesets/http/) | -| `http_request_api_gateway` | [API Gateway](/api-shield/api-gateway/) | -| `http_request_firewall_custom` | [Custom rules (Web Application Firewall)](/waf/custom-rules/) | -| `http_ratelimit` | [Rate limiting rules (WAF)](/waf/rate-limiting-rules/) | -| _N/A_ (internal phase) | [API Shield](/api-shield/) | -| `http_request_firewall_managed` | [WAF Managed Rules](/waf/managed-rules/) | -| `http_request_sbfm` | [Super Bot Fight Mode](/bots/get-started/super-bot-fight-mode/) | -| _N/A_ (internal phase) | [Cloudflare Access](/cloudflare-one/policies/access/) | -| `http_request_redirect` | [Bulk Redirects](/rules/url-forwarding/bulk-redirects/) | -| _N/A_ (internal phase) | [Managed Transforms](/rules/transform/managed-transforms/) | -| `http_request_late_transform` | [HTTP Request Header Modification Rules](/rules/transform/request-header-modification/) | -| `http_request_cache_settings` | [Cache Rules](/cache/how-to/cache-rules/) | -| `http_request_snippets` | [Snippets](/rules/snippets/) | -| `http_request_cloud_connector` | [Cloud Connector](/rules/cloud-connector/) | +| Phase name | Used in product/feature | +| ------------------------------- | ------------------------------------------------------------------------------- | +| `http_request_sanitize` | [URL normalization](/rules/normalization/) | +| `http_request_dynamic_redirect` | [Single Redirects](/rules/url-forwarding/single-redirects/) | +| `http_request_transform` | [URL Rewrite Rules](/rules/transform/url-rewrite/) | +| _N/A_ (internal phase) | [Waiting Room Rules](/waiting-room/additional-options/waiting-room-rules/) | +| `http_config_settings` | [Configuration Rules](/rules/configuration-rules/) | +| `http_request_origin` | [Origin Rules](/rules/origin-rules/) | +| `ddos_l7`\* | [HTTP DDoS Attack Protection](/ddos-protection/managed-rulesets/http/) | +| `http_request_api_gateway` | [API Gateway](/api-shield/api-gateway/) | +| `http_request_firewall_custom` | [Custom rules (Web Application Firewall)](/waf/custom-rules/) | +| `http_ratelimit` | [Rate limiting rules (WAF)](/waf/rate-limiting-rules/) | +| _N/A_ (internal phase) | [API Shield](/api-shield/) | +| `http_request_firewall_managed` | [WAF Managed Rules](/waf/managed-rules/) | +| `http_request_sbfm` | [Super Bot Fight Mode](/bots/get-started/super-bot-fight-mode/) | +| _N/A_ (internal phase) | [Cloudflare Access](/cloudflare-one/policies/access/) | +| `http_request_redirect` | [Bulk Redirects](/rules/url-forwarding/bulk-redirects/) | +| _N/A_ (internal phase) | [Managed Transforms](/rules/transform/managed-transforms/) | +| `http_request_late_transform` | [Request Header Transform Rules](/rules/transform/request-header-modification/) | +| `http_request_cache_settings` | [Cache Rules](/cache/how-to/cache-rules/) | +| `http_request_snippets` | [Snippets](/rules/snippets/) | +| `http_request_cloud_connector` | [Cloud Connector](/rules/cloud-connector/) | \* _This phase is for configuration purposes only — the corresponding rules will not be executed at this stage in the request handling process._ @@ -59,12 +59,12 @@ The phases execute in the order they appear in the table. The phases execute in the order they appear in the table. -| Phase name | Used in product/feature | -| --------------------------------- | ----------------------------------------------------------------------------------------- | -| `http_custom_errors` | [Custom Errors](/rules/custom-errors/) | -| _N/A_ (internal phase) | [Managed Transforms](/rules/transform/managed-transforms/) | -| `http_response_headers_transform` | [HTTP Response Header Modification Rules](/rules/transform/response-header-modification/) | -| `http_ratelimit` | [Rate limiting rules](/waf/rate-limiting-rules/) (when they use response information) | -| `http_response_compression` | [Compression Rules](/rules/compression-rules/) | -| `http_response_firewall_managed` | [Cloudflare Sensitive Data Detection](/waf/managed-rules/) (Data Loss Prevention) | -| `http_log_custom_fields` | [Logpush custom fields](/logs/reference/custom-fields/) | +| Phase name | Used in product/feature | +| --------------------------------- | ------------------------------------------------------------------------------------- | +| `http_custom_errors` | [Custom Errors](/rules/custom-errors/) | +| _N/A_ (internal phase) | [Managed Transforms](/rules/transform/managed-transforms/) | +| `http_response_headers_transform` | [Response Header Transform Rules](/rules/transform/response-header-modification/) | +| `http_ratelimit` | [Rate limiting rules](/waf/rate-limiting-rules/) (when they use response information) | +| `http_response_compression` | [Compression Rules](/rules/compression-rules/) | +| `http_response_firewall_managed` | [Cloudflare Sensitive Data Detection](/waf/managed-rules/) (Data Loss Prevention) | +| `http_log_custom_fields` | [Logpush custom fields](/logs/reference/custom-fields/) | diff --git a/src/content/docs/ruleset-engine/rules-language/functions.mdx b/src/content/docs/ruleset-engine/rules-language/functions.mdx index 597ad4c8c0259a6..6c30cd46938a839 100644 --- a/src/content/docs/ruleset-engine/rules-language/functions.mdx +++ b/src/content/docs/ruleset-engine/rules-language/functions.mdx @@ -120,7 +120,7 @@ Decodes a Base64-encoded String specified in `source`. For example, with the following HTTP request header: `client_id: MTIzYWJj`, `(any(decode_base64(http.request.headers["client_id"][*])[*] eq "123abc"))` would return `true`. :::caution -You can only use the `decode_base64()` function in [header modification rules](/rules/transform/), [custom rules](/waf/custom-rules/), and [rate limiting rules](/waf/rate-limiting-rules/). +You can only use the `decode_base64()` function in [header transform rules](/rules/transform/), [custom rules](/waf/custom-rules/), and [rate limiting rules](/waf/rate-limiting-rules/). ::: ### `ends_with` diff --git a/src/content/docs/ssl/edge-certificates/additional-options/http-strict-transport-security.mdx b/src/content/docs/ssl/edge-certificates/additional-options/http-strict-transport-security.mdx index 1fc89a0390777c1..09df44af8c3e88c 100644 --- a/src/content/docs/ssl/edge-certificates/additional-options/http-strict-transport-security.mdx +++ b/src/content/docs/ssl/edge-certificates/additional-options/http-strict-transport-security.mdx @@ -70,7 +70,7 @@ To enable HSTS with the API, send a [`PATCH`](/api/resources/zones/subresources/ :::note -To enable HSTS on a specific subdomain only, configure a [subdomain setup](/dns/zone-setups/subdomain-setup/). Alternatively, you can add the appropriate HSTS header at the origin, or use an [HTTP response header modification rule](/rules/transform/response-header-modification/). +To enable HSTS on a specific subdomain only, configure a [subdomain setup](/dns/zone-setups/subdomain-setup/). Alternatively, you can add the appropriate HSTS header at the origin, or use a [response header transform rule](/rules/transform/response-header-modification/). ::: diff --git a/src/content/docs/ssl/troubleshooting/general-ssl-errors.mdx b/src/content/docs/ssl/troubleshooting/general-ssl-errors.mdx index eff8c957c80ffe3..d0096ecde90667a 100644 --- a/src/content/docs/ssl/troubleshooting/general-ssl-errors.mdx +++ b/src/content/docs/ssl/troubleshooting/general-ssl-errors.mdx @@ -114,13 +114,12 @@ The HSTS headers (`Strict-Transport-Security` and `X-Content-Type-Options`) in t ### Resolution -You may have configured [HTTP Response Header Modification Rules](/rules/transform/response-header-modification) that are overriding the HSTS header values defined in the **SSL/TLS** app. +You may have configured [Response Header Transform Rules](/rules/transform/response-header-modification) that are overriding the HSTS header values defined in the **SSL/TLS** app. 1. Go to **Rules** > **Overview**. -2. Next to **Response Header Transform Rules**, select **Manage Response Header Transform Rules**. -3. Check the existing rules for a rule that is setting the value of one of the HSTS headers (`Strict-Transport-Security` or `X-Content-Type-Options`). -4. Delete (or edit) the rule so that the HSTS configuration settings defined in the **SSL/TLS** app are applied. -5. Repeat this procedure for the other HSTS header. +2. Under **Response Header Transform Rules**, search for a rule setting the value of one of the HSTS headers (`Strict-Transport-Security` or `X-Content-Type-Options`). +3. Delete (or edit) the rule so that the HSTS configuration settings defined in the **SSL/TLS** app are applied. +4. Repeat this procedure for the other HSTS header. --- @@ -144,9 +143,7 @@ You are getting the error `NET::ERR_CERT_COMMON_NAME_INVALID` in your browser. The following [`openssl`](https://www.openssl.org/) command might help troubleshooting TLS handshake between the client and the Cloudflare network edge: ```sh - openssl s_client -connect example.com:443 -servername example.com version - ``` ::: @@ -155,5 +152,4 @@ openssl s_client -connect example.com:443 -servername example.com version ## Kaspersky Antivirus -To avoid SSL errors with the Cloudflare dashboard when using Kaspersky -Antivirus, allow `dash.cloudflare.com` in Kaspersky. +To avoid SSL errors with the Cloudflare dashboard when using Kaspersky Antivirus, allow `dash.cloudflare.com` in Kaspersky. diff --git a/src/content/docs/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors.mdx b/src/content/docs/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors.mdx index 75f0d414e92f9a1..742b75633c822d9 100644 --- a/src/content/docs/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors.mdx +++ b/src/content/docs/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors.mdx @@ -337,7 +337,6 @@ Contact [Cloudflare Support](/support/contacting-cloudflare-support/) with the f - A screenshot of the 1018 error including the **RayID** mentioned in the error message. - A [HAR file](/support/troubleshooting/general-troubleshooting/gathering-information-for-troubleshooting-sites/) captured while duplicating the error. - ## Error 1019: Compute server error This error indicates a compute server error related to a Cloudflare Worker. @@ -488,7 +487,7 @@ This error indicates that an attempt was made to modify a restricted HTTP header ### Common cause -You are trying to modify an HTTP header that HTTP Request Header Modification Rules cannot change. +You are trying to modify an HTTP header that Request Header Transform Rules cannot change. ### Resolution @@ -549,7 +548,7 @@ This error indicates that the number of requests queued on Cloudflare's edge exc ### Common cause -There are too many requests queued on Cloudflare's edge that are awaiting process by your origin web server. This limit protects Cloudflare's systems. +There are too many requests queued on Cloudflare's edge that are awaiting process by your origin web server. This limit protects Cloudflare's systems. ### Resolution diff --git a/src/content/docs/terraform/additional-configurations/rate-limiting-rules.mdx b/src/content/docs/terraform/additional-configurations/rate-limiting-rules.mdx index 685c5c99dd32477..317ae6563f652d3 100644 --- a/src/content/docs/terraform/additional-configurations/rate-limiting-rules.mdx +++ b/src/content/docs/terraform/additional-configurations/rate-limiting-rules.mdx @@ -59,7 +59,8 @@ resource "cloudflare_ruleset" "zone_rl" { } ``` -<Render file="add-new-rule" params={{ one: "rate limiting rule" }} /> <br /> +<Render file="add-new-rule" params={{ ruleType: "rate limiting rule" }} /> +<br /> ## Create a rate limiting rule at the account level @@ -120,7 +121,8 @@ resource "cloudflare_ruleset" "account_rl_entrypoint" { } ``` -<Render file="add-new-rule" params={{ one: "rate limiting rule" }} /> <br /> +<Render file="add-new-rule" params={{ ruleType: "rate limiting rule" }} /> +<br /> ## Create an advanced rate limiting rule @@ -162,4 +164,5 @@ resource "cloudflare_ruleset" "zone_rl_custom_response" { } ``` -<Render file="add-new-rule" params={{ one: "rate limiting rule" }} /> <br /> +<Render file="add-new-rule" params={{ ruleType: "rate limiting rule" }} /> +<br /> diff --git a/src/content/docs/terraform/additional-configurations/transform-rules.mdx b/src/content/docs/terraform/additional-configurations/transform-rules.mdx index b49d65debb5940c..620bfc5745a6bca 100644 --- a/src/content/docs/terraform/additional-configurations/transform-rules.mdx +++ b/src/content/docs/terraform/additional-configurations/transform-rules.mdx @@ -13,9 +13,9 @@ import { Render } from "~/components"; This page provides examples of creating [Transform Rules](/rules/transform/) in a zone using Terraform. The examples cover the following scenarios: -- [Create a Rewrite URL Rule](#create-a-rewrite-url-rule) -- [Create an HTTP Request Header Modification Rule](#create-an-http-request-header-modification-rule) -- [Create an HTTP Response Header Modification Rule](#create-an-http-response-header-modification-rule) +- [Create a URL rewrite rule](#create-a-url-rewrite-rule) +- [Create a request header transform rule](#create-a-request-header-transform-rule) +- [Create a response header transform rule](#create-a-response-header-transform-rule) ## Before you start @@ -29,9 +29,9 @@ This page provides examples of creating [Transform Rules](/rules/transform/) in --- -## Create a Rewrite URL Rule +## Create a URL rewrite rule -The following example creates a Rewrite URL Rule that rewrites requests for `example.com/old-folder` to `example.com/new-folder`: +The following example creates a URL rewrite rule that rewrites requests for `example.com/old-folder` to `example.com/new-folder`: <Render file="v4-code-snippets" /> @@ -45,7 +45,7 @@ resource "cloudflare_ruleset" "transform_url_rewrite" { rules { ref = "url_rewrite_old_folder" - description = "Example Rewrite URL Rule" + description = "Example URL rewrite rule" expression = "(http.host eq \"example.com\" and http.request.uri.path eq \"/old-folder\")" action = "rewrite" action_parameters { @@ -59,11 +59,11 @@ resource "cloudflare_ruleset" "transform_url_rewrite" { } ``` -<Render file="add-new-rule" params={{ one: "Rewrite URL Rule" }} /> <br /> +<Render file="add-new-rule" params={{ ruleType: "URL rewrite rule" }} /> <br /> -For more information on rewriting URLs, refer to [Rewrite URL Rules](/rules/transform/url-rewrite/). +For more information on rewriting URLs, refer to [URL Rewrite Rules](/rules/transform/url-rewrite/). -## Create an HTTP Request Header Modification Rule +## Create a request header transform rule The following configuration example performs the following adjustments to HTTP request headers: @@ -83,7 +83,7 @@ resource "cloudflare_ruleset" "transform_modify_request_headers" { rules { ref = "modify_request_headers" - description = "Example HTTP Request Header Modification Rule" + description = "Example request header transform rule" expression = "true" action = "rewrite" action_parameters { @@ -108,12 +108,13 @@ resource "cloudflare_ruleset" "transform_modify_request_headers" { <Render file="add-new-rule" - params={{ one: "Request Header Modification Rule" }} -/> <br /> + params={{ ruleType: "request header transform rule" }} +/> +<br /> -For more information on modifying request headers, refer to [HTTP Request Header Modification Rules](/rules/transform/request-header-modification/). +For more information on modifying request headers, refer to [Request Header Transform Rules](/rules/transform/request-header-modification/). -## Create an HTTP Response Header Modification Rule +## Create a response header transform rule The following configuration example performs the following adjustments to HTTP response headers: @@ -133,7 +134,7 @@ resource "cloudflare_ruleset" "transform_modify_response_headers" { rules { ref = "modify_response_headers" - description = "Example HTTP Response Header Modification Rule" + description = "Example response header transform rule" expression = "true" action = "rewrite" action_parameters { @@ -158,7 +159,8 @@ resource "cloudflare_ruleset" "transform_modify_response_headers" { <Render file="add-new-rule" - params={{ one: "Response Header Modification Rule" }} -/> <br /> + params={{ ruleType: "response header transform rule" }} +/> +<br /> -For more information on modifying response headers, refer to [HTTP Response Header Modification Rules](/rules/transform/response-header-modification/). +For more information on modifying response headers, refer to [Response Header Transform Rules](/rules/transform/response-header-modification/). diff --git a/src/content/docs/terraform/additional-configurations/waf-custom-rules.mdx b/src/content/docs/terraform/additional-configurations/waf-custom-rules.mdx index 17211389073d2ba..35ccac68641eb95 100644 --- a/src/content/docs/terraform/additional-configurations/waf-custom-rules.mdx +++ b/src/content/docs/terraform/additional-configurations/waf-custom-rules.mdx @@ -58,7 +58,7 @@ resource "cloudflare_ruleset" "zone_custom_firewall" { } ``` -<Render file="add-new-rule" params={{ one: "custom rule" }} /> <br /> +<Render file="add-new-rule" params={{ ruleType: "custom rule" }} /> <br /> ### Add a custom rule challenging requests with leaked credentials @@ -151,8 +151,9 @@ resource "cloudflare_ruleset" "account_firewall_custom_ruleset" { <Render file="add-new-rule" - params={{ one: "custom rule in the custom ruleset" }} -/> <br /> + params={{ ruleType: "custom rule in the custom ruleset" }} +/> +<br /> The following configuration deploys the custom ruleset at the account level. It defines a dependency on the `account_firewall_custom_ruleset` resource and uses the ID of the created custom ruleset in `action_parameters`: @@ -220,7 +221,7 @@ resource "cloudflare_ruleset" "account_firewall_custom_ruleset_exposed_creds" { } ``` -<Render file="add-new-rule" params={{ one: "rule" }} /> <br /> +<Render file="add-new-rule" params={{ ruleType: "rule" }} /> <br /> The following configuration deploys the custom ruleset. It defines a dependency on the `account_firewall_custom_ruleset_exposed_creds` resource and obtains the ID of the created custom ruleset: diff --git a/src/content/partials/bots/sequence-rules-availability.mdx b/src/content/partials/bots/sequence-rules-availability.mdx index c4d5e4b814e5f3d..670a535c93e063a 100644 --- a/src/content/partials/bots/sequence-rules-availability.mdx +++ b/src/content/partials/bots/sequence-rules-availability.mdx @@ -1,14 +1,13 @@ --- {} - --- These sequence fields are available in: - [Custom rules](/waf/custom-rules/) (`http_request_firewall_custom` phase) - [Rate limiting rules](/waf/rate-limiting-rules/) (`http_request_ratelimit`) -- [Bulk redirects](/workers/examples/bulk-redirects/) (`http_request_redirect`) -- [HTTP request header modification rules](/rules/transform/response-header-modification/) (`http_request_late_transform`) +- [Bulk Redirects](/workers/examples/bulk-redirects/) (`http_request_redirect`) +- [Request Header Transform Rules](/rules/transform/response-header-modification/) (`http_request_late_transform`) <table> <thead> @@ -41,4 +40,4 @@ These sequence fields are available in: <td><p>`{"f54dac32": 1000, "c821cc00": 2000}`</p></td> </tr> </tbody> -</table> \ No newline at end of file +</table> diff --git a/src/content/partials/terraform/add-new-rule.mdx b/src/content/partials/terraform/add-new-rule.mdx index 672ff50023f4a59..5801b74772b3acd 100644 --- a/src/content/partials/terraform/add-new-rule.mdx +++ b/src/content/partials/terraform/add-new-rule.mdx @@ -1,8 +1,8 @@ --- -inputParameters: ruleType - +params: + - ruleType --- -import { Markdown } from "~/components" +import { Markdown } from "~/components"; -To create another {props.one}, add a new `rules` object to the same `cloudflare_ruleset` resource. +To create another {props.ruleType}, add a new `rules` object to the same `cloudflare_ruleset` resource.