diff --git a/src/content/docs/cache/how-to/cache-rules/terraform-example.mdx b/src/content/docs/cache/how-to/cache-rules/terraform-example.mdx index 354c8a68e5c331f..b05f73812dcde5f 100644 --- a/src/content/docs/cache/how-to/cache-rules/terraform-example.mdx +++ b/src/content/docs/cache/how-to/cache-rules/terraform-example.mdx @@ -8,7 +8,7 @@ head: content: Cache Rules — Terraform example --- -import { Details } from "~/components"; +import { Details, Render } from "~/components"; The following example defines a single cache rule for a zone using Terraform. The rule configures several cache settings and sets a custom cache key for incoming requests addressed at `example.net`. @@ -82,6 +82,12 @@ resource "cloudflare_ruleset" "cache_rules_example" { } ``` + + For additional guidance on using Terraform with Cloudflare, refer to [Terraform](/terraform/). diff --git a/src/content/docs/rules/compression-rules/examples/disable-all-brotli.mdx b/src/content/docs/rules/compression-rules/examples/disable-all-brotli.mdx index 84e49bef9212fab..46bed2db9f2d119 100644 --- a/src/content/docs/rules/compression-rules/examples/disable-all-brotli.mdx +++ b/src/content/docs/rules/compression-rules/examples/disable-all-brotli.mdx @@ -9,7 +9,7 @@ description: Create a compression rule to turn off Brotli compression for all incoming requests of a given zone. --- -import { Example, TabItem, Tabs, APIRequest } from "~/components"; +import { Example, TabItem, Tabs, APIRequest, Render } from "~/components"; @@ -40,6 +40,7 @@ The following example sets the rules of an existing [entry point ruleset](/rules json={{ rules: [ { + ref: "always_use_gzip", expression: "true", action: "compress_response", action_parameters: { @@ -50,4 +51,6 @@ The following example sets the rules of an existing [entry point ruleset](/rules }} /> + + diff --git a/src/content/docs/rules/compression-rules/examples/disable-compression-avif.mdx b/src/content/docs/rules/compression-rules/examples/disable-compression-avif.mdx index 58b02d20ee347bf..45797c2ecbf4e66 100644 --- a/src/content/docs/rules/compression-rules/examples/disable-compression-avif.mdx +++ b/src/content/docs/rules/compression-rules/examples/disable-compression-avif.mdx @@ -11,7 +11,7 @@ description: Create a compression rule to turn off compression for AVIF images, request. --- -import { Example, TabItem, Tabs, APIRequest } from "~/components"; +import { Example, TabItem, Tabs, APIRequest, Render } from "~/components"; @@ -42,6 +42,7 @@ The following example sets the rules of an existing [entry point ruleset](/rules json={{ rules: [ { + ref: "disable_compression_for_avif", expression: 'http.response.content_type.media_type eq "image/avif" or http.request.uri.path.extension eq "avif"', action: "compress_response", @@ -53,4 +54,6 @@ The following example sets the rules of an existing [entry point ruleset](/rules }} /> + + diff --git a/src/content/docs/rules/compression-rules/examples/enable-zstandard.mdx b/src/content/docs/rules/compression-rules/examples/enable-zstandard.mdx index 9ac33b53d5252f1..0457631a76e6037 100644 --- a/src/content/docs/rules/compression-rules/examples/enable-zstandard.mdx +++ b/src/content/docs/rules/compression-rules/examples/enable-zstandard.mdx @@ -7,7 +7,7 @@ title: Enable Zstandard compression for default content types description: Create a compression rule to turn on Zstandard compression for response content types where Cloudflare applies compression by default. --- -import { Example, TabItem, Tabs, APIRequest } from "~/components"; +import { Example, TabItem, Tabs, APIRequest, Render } from "~/components"; @@ -38,6 +38,7 @@ The following example sets the rules of an existing [entry point ruleset](/rules json={{ rules: [ { + ref: "use_zstd_compression", expression: '(http.response.content_type.media_type in {"text/html" "text/richtext" "text/plain" "text/css" "text/x-script" "text/x-component" "text/x-java-source" "text/x-markdown" "application/javascript" "application/x-javascript" "text/javascript" "text/js" "image/x-icon" "image/vnd.microsoft.icon" "application/x-perl" "application/x-httpd-cgi" "text/xml" "application/xml" "application/rss+xml" "application/vnd.api+json" "application/x-protobuf" "application/json" "multipart/bag" "multipart/mixed" "application/xhtml+xml" "font/ttf" "font/otf" "font/x-woff" "image/svg+xml" "application/vnd.ms-fontobject" "application/ttf" "application/x-ttf" "application/otf" "application/x-otf" "application/truetype" "application/opentype" "application/x-opentype" "application/font-woff" "application/eot" "application/font" "application/font-sfnt" "application/wasm" "application/javascript-binast" "application/manifest+json" "application/ld+json" "application/graphql+json" "application/geo+json"})', action: "compress_response", @@ -49,4 +50,6 @@ The following example sets the rules of an existing [entry point ruleset](/rules }} /> + + diff --git a/src/content/docs/rules/compression-rules/examples/gzip-for-csv.mdx b/src/content/docs/rules/compression-rules/examples/gzip-for-csv.mdx index cc95a354f981571..c61264943f34774 100644 --- a/src/content/docs/rules/compression-rules/examples/gzip-for-csv.mdx +++ b/src/content/docs/rules/compression-rules/examples/gzip-for-csv.mdx @@ -9,7 +9,7 @@ description: Create a compression rule to set Gzip compression as the preferred compression method for CSV files. --- -import { Example, TabItem, Tabs, APIRequest } from "~/components"; +import { Example, TabItem, Tabs, APIRequest, Render } from "~/components"; @@ -40,6 +40,7 @@ The following example sets the rules of an existing [entry point ruleset](/rules json={{ rules: [ { + ref: "use_gzip_for_csv", expression: 'http.request.uri.path.extension eq "csv"', action: "compress_response", action_parameters: { @@ -50,4 +51,6 @@ The following example sets the rules of an existing [entry point ruleset](/rules }} /> + + diff --git a/src/content/docs/rules/compression-rules/examples/only-brotli-url-path.mdx b/src/content/docs/rules/compression-rules/examples/only-brotli-url-path.mdx index 2eccbfb11d680fc..48f0169fac3a3d2 100644 --- a/src/content/docs/rules/compression-rules/examples/only-brotli-url-path.mdx +++ b/src/content/docs/rules/compression-rules/examples/only-brotli-url-path.mdx @@ -9,7 +9,7 @@ description: Create a compression rule to set Brotli as the only supported compression algorithm for a specific URI path. --- -import { Example, TabItem, Tabs, APIRequest } from "~/components"; +import { Example, TabItem, Tabs, APIRequest, Render } from "~/components"; @@ -42,6 +42,7 @@ The following example sets the rules of an existing [entry point ruleset](/rules json={{ rules: [ { + ref: "use_only_brotli_for_assets_tar", expression: 'http.request.uri.path eq "/download/assets.tar"', action: "compress_response", action_parameters: { @@ -52,4 +53,6 @@ The following example sets the rules of an existing [entry point ruleset](/rules }} /> + + diff --git a/src/content/docs/rules/configuration-rules/create-api.mdx b/src/content/docs/rules/configuration-rules/create-api.mdx index 103e88bdb4f4971..e95b3411b96074d 100644 --- a/src/content/docs/rules/configuration-rules/create-api.mdx +++ b/src/content/docs/rules/configuration-rules/create-api.mdx @@ -43,6 +43,7 @@ The following example sets the rules of an existing phase ruleset (`{ruleset_id} json={{ rules: [ { + ref: "enable_email_obfuscation_bic", expression: 'starts_with(http.request.uri.path, "/contact-us/")', description: "Obfuscates email addresses and enables BIC in contacts page", @@ -56,6 +57,8 @@ The following example sets the rules of an existing phase ruleset (`{ruleset_id} }} /> + +
@@ -68,6 +71,7 @@ The following example sets the rules of an existing phase ruleset (`{ruleset_id} json={{ rules: [ { + ref: "enable_under_attack_in_admin", expression: 'http.host eq "admin.example.com"', description: "Turn on Under Attack mode for admin area", action: "set_config", @@ -79,6 +83,8 @@ The following example sets the rules of an existing phase ruleset (`{ruleset_id} }} /> + +
--- diff --git a/src/content/docs/rules/configuration-rules/examples/define-single-configuration-terraform.mdx b/src/content/docs/rules/configuration-rules/examples/define-single-configuration-terraform.mdx index 93a41759157cce7..889fe9274c347b1 100644 --- a/src/content/docs/rules/configuration-rules/examples/define-single-configuration-terraform.mdx +++ b/src/content/docs/rules/configuration-rules/examples/define-single-configuration-terraform.mdx @@ -37,4 +37,6 @@ resource "cloudflare_ruleset" "http_config_rules_example" { } ``` + + diff --git a/src/content/docs/rules/custom-errors/create-rules.mdx b/src/content/docs/rules/custom-errors/create-rules.mdx index 0b8e30a737bda3d..c4a115ddb9aea04 100644 --- a/src/content/docs/rules/custom-errors/create-rules.mdx +++ b/src/content/docs/rules/custom-errors/create-rules.mdx @@ -5,7 +5,7 @@ sidebar: order: 3 --- -import { APIRequest } from "~/components"; +import { APIRequest, Render } from "~/components"; ## In the dashboard @@ -111,6 +111,7 @@ This example configures a custom error rule returning a [previously created cust json={{ rules: [ { + ref: "serve_500_template", action: "serve_error", action_parameters: { asset_name: "500_error_template", @@ -123,6 +124,8 @@ This example configures a custom error rule returning a [previously created cust }} /> + + This `PUT` request, corresponding to the [Update a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/update/) operation, replaces any existing rules in the `http_custom_errors` phase entry point ruleset. ## Required API token permissions diff --git a/src/content/docs/rules/custom-errors/example-rules.mdx b/src/content/docs/rules/custom-errors/example-rules.mdx index b4d282c492b6ec2..4c1318315b645f4 100644 --- a/src/content/docs/rules/custom-errors/example-rules.mdx +++ b/src/content/docs/rules/custom-errors/example-rules.mdx @@ -5,7 +5,7 @@ sidebar: order: 4 --- -import { Tabs, TabItem, APIRequest } from "~/components"; +import { Tabs, TabItem, APIRequest, Render } from "~/components"; The provided examples use the following fields in their rule expressions: @@ -48,6 +48,7 @@ This example configures a custom JSON error response for all 5XX errors (`500`-` json={{ rules: [ { + ref: "json_response_for_5xx_errors", action: "serve_error", action_parameters: { content: '{"message": "A server error occurred."}', @@ -61,6 +62,8 @@ This example configures a custom JSON error response for all 5XX errors (`500`-` }} /> + + This `PUT` request, corresponding to the [Update a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/update/) operation, replaces any existing rules in the `http_custom_errors` phase entry point ruleset. @@ -103,6 +106,7 @@ This example configures a custom HTML error response for responses with a `500` json={{ rules: [ { + ref: "html_response_500_to_503", action: "serve_error", action_parameters: { content: @@ -117,6 +121,8 @@ This example configures a custom HTML error response for responses with a `500` }} /> + + This `PUT` request, corresponding to the [Update a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/update/) operation, replaces any existing rules in the `http_custom_errors` phase entry point ruleset. @@ -154,6 +160,7 @@ This example configures a custom HTML error response for [Cloudflare error 1020] json={{ rules: [ { + ref: "html_response_cf_1020", action: "serve_error", action_parameters: { content: @@ -167,6 +174,8 @@ This example configures a custom HTML error response for [Cloudflare error 1020] }} /> + + This `PUT` request, corresponding to the [Update a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/update/) operation, replaces any existing rules in the `http_custom_errors` phase entry point ruleset. @@ -204,6 +213,7 @@ This example configures a custom error rule returning a previously created custo json={{ rules: [ { + ref: "serve_error_500_asset", action: "serve_error", action_parameters: { asset_name: "500_error_template", @@ -216,6 +226,8 @@ This example configures a custom error rule returning a previously created custo }} /> + + This `PUT` request, corresponding to the [Update a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/update/) operation, replaces any existing rules in the `http_custom_errors` phase entry point ruleset. diff --git a/src/content/docs/rules/origin-rules/create-api.mdx b/src/content/docs/rules/origin-rules/create-api.mdx index cc4fb25c0b587ff..a4091fd4249318f 100644 --- a/src/content/docs/rules/origin-rules/create-api.mdx +++ b/src/content/docs/rules/origin-rules/create-api.mdx @@ -51,6 +51,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "override_sni_for_admin", expression: 'http.host eq "admin.example.com"', description: "SNI Override for the admin area", action: "route", @@ -64,6 +65,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` }} /> + + --- diff --git a/src/content/docs/rules/origin-rules/examples/define-single-origin-terraform.mdx b/src/content/docs/rules/origin-rules/examples/define-single-origin-terraform.mdx index be5856aed0ba44e..f77c19d75ca5e75 100644 --- a/src/content/docs/rules/origin-rules/examples/define-single-origin-terraform.mdx +++ b/src/content/docs/rules/origin-rules/examples/define-single-origin-terraform.mdx @@ -40,4 +40,6 @@ resource "cloudflare_ruleset" "http_origin_example" { } ``` + + 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 7f4cea2d6a2dc88..77d8c02a1602ab4 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 @@ -45,6 +45,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "add_header_source", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first request header transform rule", action: "rewrite", @@ -71,6 +72,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "add_header_source", "id": "", "version": "1", "action": "rewrite", @@ -97,6 +99,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } ``` + +
@@ -109,6 +113,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "add_header_bot_score", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first request header transform rule", action: "rewrite", @@ -135,6 +140,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "add_header_bot_score", "id": "", "version": "1", "action": "rewrite", @@ -161,6 +167,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } ``` + +
@@ -173,6 +181,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "remove_header_cf_connecting_ip", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first request header transform rule", action: "rewrite", @@ -198,6 +207,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "remove_header_cf_connecting_ip", "id": "", "version": "1", "action": "rewrite", @@ -223,6 +233,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } ``` + +
--- 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 a2e40729ee2734f..a35f2dfa48438f6 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 @@ -44,6 +44,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES json={{ rules: [ { + ref: "set_resp_header_source", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first response header transform rule", action: "rewrite", @@ -70,6 +71,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES "version": "2", "rules": [ { + "ref": "set_resp_header_source", "id": "", "version": "1", "action": "rewrite", @@ -96,6 +98,8 @@ The following example configures the rules of an existing phase ruleset (`$RULES } ``` + +
@@ -108,6 +112,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES json={{ rules: [ { + ref: "set_resp_header_bot_score", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first response header transform rule", action: "rewrite", @@ -134,6 +139,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES "version": "2", "rules": [ { + "ref": "set_resp_header_bot_score", "id": "", "version": "1", "action": "rewrite", @@ -160,6 +166,8 @@ The following example configures the rules of an existing phase ruleset (`$RULES } ``` + +
@@ -172,6 +180,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES json={{ rules: [ { + ref: "add_resp_header_set_mycookie", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first response header transform rule", action: "rewrite", @@ -198,6 +207,7 @@ The following example configures the rules of an existing phase ruleset (`$RULES "version": "2", "rules": [ { + "ref": "add_resp_header_set_mycookie", "id": "", "version": "1", "action": "rewrite", @@ -224,6 +234,8 @@ The following example configures the rules of an existing phase ruleset (`$RULES } ``` + +
@@ -236,6 +248,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "remove_resp_header_cf_connecting_ip", expression: '(starts_with(http.request.uri.path, "/en/"))', description: "My first response header transform rule", action: "rewrite", @@ -261,6 +274,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "remove_resp_header_cf_connecting_ip", "id": "", "version": "1", "action": "rewrite", @@ -286,6 +300,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } ``` + +
--- 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 bd6957bcdea004e..1daaea5870a0d5a 100644 --- a/src/content/docs/rules/transform/url-rewrite/create-api.mdx +++ b/src/content/docs/rules/transform/url-rewrite/create-api.mdx @@ -44,6 +44,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "rewrite_eu_to_emea", expression: '(http.request.uri.query contains "eu")', description: "My first static URL rewrite rule", action: "rewrite", @@ -62,6 +63,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` ```json output { "result": { + "ref": "rewrite_eu_to_emea", "id": "", "name": "Zone-level Transform Ruleset", "description": "Zone-level ruleset that will execute Transform Rules.", @@ -94,6 +96,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } ``` + +
@@ -106,6 +110,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "rewrite_2012_to_archive", expression: 'starts_with(http.request.uri.path, "/news/2012/")', description: "My first dynamic URL rewrite rule", action: "rewrite", @@ -131,6 +136,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "rewrite_2012_to_archive", "id": "", "version": "1", "action": "rewrite", @@ -156,6 +162,8 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` } ``` + +
--- diff --git a/src/content/docs/rules/url-forwarding/bulk-redirects/create-api.mdx b/src/content/docs/rules/url-forwarding/bulk-redirects/create-api.mdx index fc457ab01cc1818..6152657de875e2c 100644 --- a/src/content/docs/rules/url-forwarding/bulk-redirects/create-api.mdx +++ b/src/content/docs/rules/url-forwarding/bulk-redirects/create-api.mdx @@ -141,6 +141,7 @@ The following request of the [Create an account ruleset](/api/resources/rulesets phase: "http_request_redirect", rules: [ { + ref: "enable_my_redirect_list", expression: "http.request.full_uri in $my_redirect_list", description: "Bulk Redirect rule.", action: "redirect", @@ -164,6 +165,7 @@ The following request of the [Create an account ruleset](/api/resources/rulesets "version": "1", "rules": [ { + "ref": "enable_my_redirect_list", "id": "8da312df846b4258a05bcd454ea943be", "version": "1", "expression": "http.request.full_uri in $my_redirect_list", @@ -187,6 +189,8 @@ The following request of the [Create an account ruleset](/api/resources/rulesets } ``` + + If there is already a phase entry point ruleset for the `http_request_redirect` phase, use the [Update an account ruleset](/api/resources/rulesets/methods/update/) operation instead, like in the following example: + + If there is already a phase entry point ruleset for the `http_request_dynamic_redirect` phase, use the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation instead, like in the following example: + diff --git a/src/content/docs/terraform/additional-configurations/transform-rules.mdx b/src/content/docs/terraform/additional-configurations/transform-rules.mdx index e1f123a6d6f776f..a353e7e2b1925d8 100644 --- a/src/content/docs/terraform/additional-configurations/transform-rules.mdx +++ b/src/content/docs/terraform/additional-configurations/transform-rules.mdx @@ -67,6 +67,8 @@ resource "cloudflare_ruleset" "transform_url_rewrite" { } ``` + +
For more information on rewriting URLs, refer to [URL Rewrite Rules](/rules/transform/url-rewrite/). @@ -114,11 +116,12 @@ resource "cloudflare_ruleset" "transform_modify_request_headers" { } ``` + + -
For more information on modifying request headers, refer to [Request Header Transform Rules](/rules/transform/request-header-modification/). @@ -165,11 +168,12 @@ resource "cloudflare_ruleset" "transform_modify_response_headers" { } ``` + + -
For more information on modifying response headers, refer to [Response Header Transform Rules](/rules/transform/response-header-modification/). diff --git a/src/content/partials/rules/origin-rules-api-change-host-header-dns-record.mdx b/src/content/partials/rules/origin-rules-api-change-host-header-dns-record.mdx index 3718cb49aabb27f..65f1128656232c1 100644 --- a/src/content/partials/rules/origin-rules-api-change-host-header-dns-record.mdx +++ b/src/content/partials/rules/origin-rules-api-change-host-header-dns-record.mdx @@ -2,7 +2,7 @@ {} --- -import { APIRequest } from "~/components"; +import { APIRequest, Render } from "~/components"; The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single origin rule — overriding the `Host` header of incoming requests and the resolved DNS record — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. @@ -12,6 +12,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "hr_app_overrides", expression: 'starts_with(http.request.uri.path, "/hr-app/")', description: "Origin rule for the company HR application", action: "route", @@ -36,6 +37,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "hr_app_overrides", "id": "", "version": "1", "action": "route", @@ -59,3 +61,9 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "messages": [] } ``` + + diff --git a/src/content/partials/rules/origin-rules-api-change-port.mdx b/src/content/partials/rules/origin-rules-api-change-port.mdx index 1ac1b902d9854fa..b30b4127946c786 100644 --- a/src/content/partials/rules/origin-rules-api-change-port.mdx +++ b/src/content/partials/rules/origin-rules-api-change-port.mdx @@ -2,7 +2,7 @@ {} --- -import { APIRequest } from "~/components"; +import { APIRequest, Render } from "~/components"; The following example sets the rules of an existing phase ruleset (`$RULESET_ID`) to a single origin rule — overriding the port of incoming requests — using the [Update a zone ruleset](/api/resources/rulesets/methods/update/) operation. The response will contain the complete definition of the ruleset you updated. @@ -12,6 +12,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` json={{ rules: [ { + ref: "calendar_app_change_port", expression: 'starts_with(http.request.uri.path, "/team/calendar/")', description: "Origin rule for the team calendar application", action: "route", @@ -35,6 +36,7 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "version": "2", "rules": [ { + "ref": "calendar_app_change_port", "id": "", "version": "1", "action": "route", @@ -57,3 +59,9 @@ The following example sets the rules of an existing phase ruleset (`$RULESET_ID` "messages": [] } ``` + + diff --git a/src/content/partials/rules/terraform-use-ref-field.mdx b/src/content/partials/rules/terraform-use-ref-field.mdx new file mode 100644 index 000000000000000..66421d11a23f18f --- /dev/null +++ b/src/content/partials/rules/terraform-use-ref-field.mdx @@ -0,0 +1,6 @@ +--- +params: + - addDocsLocation? +--- + +Use the `ref` field to get stable rule IDs across updates when using Terraform. Adding this field prevents Terraform from recreating the rule on changes. For more information, refer to [Troubleshooting](/terraform/troubleshooting/rule-id-changes/#how-to-keep-the-same-rule-id-between-modifications){ props.addDocsLocation && " in the Terraform documentation" }.