diff --git a/public/_redirects b/public/_redirects index 789edec1f46f2b..d2eb039c758e2d 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1611,6 +1611,10 @@ /cloudflare-one/analytics/gateway/ /cloudflare-one/insights/analytics/gateway/ 301 /cloudflare-one/analytics/users/ /cloudflare-one/insights/logs/users/ 301 /cloudflare-one/api-terraform/access-api-examples/azure-group/ /cloudflare-one/api-terraform/access-api-examples/entra-group/ 301 +/cloudflare-one/api-terraform/gateway-api-examples/ /cloudflare-one/policies/gateway/ 301 +/cloudflare-one/api-terraform/gateway-api-examples/dns-policy/ /cloudflare-one/policies/gateway/dns-policies/common-policies/ 301 +/cloudflare-one/api-terraform/gateway-api-examples/network-policy/ /cloudflare-one/policies/gateway/network-policies/common-policies/ 301 +/cloudflare-one/api-terraform/gateway-api-examples/http-policy/ /cloudflare-one/policies/gateway/http-policies/common-policies/ 301 /cloudflare-one/applications/non-http/arbitrary-tcp/ /cloudflare-one/applications/non-http/cloudflared-authentication/arbitrary-tcp/ 301 /cloudflare-one/connections/connect-apps/configuration/ /cloudflare-one/connections/connect-networks/configure-tunnels/ 301 /cloudflare-one/connections/connect-apps/install-and-setup/setup/ /cloudflare-one/connections/connect-networks/get-started/ 301 diff --git a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/dns-policy.mdx b/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/dns-policy.mdx deleted file mode 100644 index 9199b04dbfb834..00000000000000 --- a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/dns-policy.mdx +++ /dev/null @@ -1,69 +0,0 @@ ---- -type: example -summary: Block users in a group from accessing a site. -tags: - - DNS policy -title: DNS policy -pcx_content_type: example -sidebar: - order: 1 -description: Block users in a group from accessing a site. - ---- - -```json -{ - "name": "Block example.com", - "conditions": [ - { - "type": "traffic", - "expression": { - "any": { - "==": { - "lhs": { - "splat": "dns.resolved_ips" - }, - "rhs": { - "ip": "203.0.113.17" - } - } - } - } - }, - { - "type": "identity", - "expression": { - "any": { - "in": { - "lhs": { - "splat": "identity.groups.name" - }, - "rhs": ["marketing"] - } - } - } - } - ], - "action": "block", - "precedence": 50000, - "enabled": true, - "description": "block example.com by resolved IP for users in marketing group", - "rule_settings": { - "block_page_enabled": true, - "block_reason": "site example.com is blocked for users in the marketing group", - "biso_admin_controls": { - "dcp": false, - "dd": false, - "dk": false, - "dp": false, - "du": false - }, - "add_headers": {}, - "ip_categories": false, - "override_host": "", - "override_ips": null, - "l4override": null - }, - "filters": ["dns"] -} -``` diff --git a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/http-policy.mdx b/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/http-policy.mdx deleted file mode 100644 index f622b0ff6c2c5d..00000000000000 --- a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/http-policy.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -type: example -summary: Block specific users from accessing a site. -tags: - - HTTP policy -title: HTTP policy -pcx_content_type: example -sidebar: - order: 3 -description: Block specific users from accessing a site. - ---- - -```json -{ - "name": "Block example.com", - "conditions": [ - { - "type": "traffic", - "expression": { - "any": { - "==": { - "lhs": { - "splat": "http.request.domains" - }, - "rhs": "example.com" - } - } - } - }, - { - "type": "identity", - "expression": { - "in": { - "lhs": "identity.email", - "rhs": ["user@example1.com"] - } - } - } - ], - "action": "block", - "precedence": 50000, - "enabled": true, - "description": "Block user@example1.com from accessing example.com", - "rule_settings": { - "block_page_enabled": false, - "block_reason": "This website is blocked", - "biso_admin_controls": { - "dcp": false, - "dd": false, - "dk": false, - "dp": false, - "du": false - }, - "add_headers": {}, - "ip_categories": false, - "override_host": "", - "override_ips": null, - "l4override": null - }, - "filters": ["http"] -} -``` diff --git a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/index.mdx b/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/index.mdx deleted file mode 100644 index 5bf62bfa1bdc5b..00000000000000 --- a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/index.mdx +++ /dev/null @@ -1,15 +0,0 @@ ---- -type: overview -pcx_content_type: example -title: Gateway API examples -sidebar: - order: 2 ---- - -import { ListExamples } from "~/components"; - -You can use the Cloudflare Gateway API to create DNS, network, and HTTP policies, including policies with multiple traffic, identity, and device posture conditions. - -## Example policies - - diff --git a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/network-policy.mdx b/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/network-policy.mdx deleted file mode 100644 index 99820c12275e1c..00000000000000 --- a/src/content/docs/cloudflare-one/api-terraform/gateway-api-examples/network-policy.mdx +++ /dev/null @@ -1,67 +0,0 @@ ---- -type: example -summary: Override one hostname with another. -tags: - - Network policy -title: Network policy -pcx_content_type: example -sidebar: - order: 2 -description: Override one hostname with another. - ---- - -```json -{ - "name": "Override example.com with 1.1.1.1", - "conditions": [ - { - "type": "traffic", - "expression": { - "and": [ - { - "in": { - "lhs": "net.dst.ip", - "rhs": [ - { - "ip": "203.0.113.17" - } - ] - } - }, - { - "==": { - "lhs": "net.dst.port", - "rhs": 80 - } - } - ] - } - } - ], - "action": "l4_override", - "precedence": 50000, - "enabled": true, - "description": "", - "rule_settings": { - "block_page_enabled": false, - "block_reason": "", - "biso_admin_controls": { - "dcp": false, - "dd": false, - "dk": false, - "dp": false, - "du": false - }, - "add_headers": {}, - "ip_categories": false, - "l4override": { - "ip": "1.1.1.1", - "port": 80 - }, - "override_host": "", - "override_ips": null - }, - "filters": ["l4"] -} -``` diff --git a/src/content/docs/cloudflare-one/policies/gateway/network-policies/common-policies.mdx b/src/content/docs/cloudflare-one/policies/gateway/network-policies/common-policies.mdx index 8786919ed12cf9..ea81857179db3a 100644 --- a/src/content/docs/cloudflare-one/policies/gateway/network-policies/common-policies.mdx +++ b/src/content/docs/cloudflare-one/policies/gateway/network-policies/common-policies.mdx @@ -260,3 +260,50 @@ curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule \ ``` + +## Override IP address + +Override traffic directed toward a specific IP address with a different IP address. + + + +| Selector | Operator | Value | Logic | Action | +| ---------------- | -------- | -------------- | ----- | ---------------- | +| Destination IP | in | `203.0.113.17` | And | Network Override | +| Destination Port | is | `80` | | | + +| Override IP | Override Port | +| ----------- | ------------- | +| `1.1.1.1` | `80` | + + + + + +```bash +curl https://api.cloudflare.com/client/v4/accounts/{account_id}/gateway/rule \ +--header "Content-Type: application/json" \ +--header "Authorization: Bearer " \ +--data '{ + "name": "Override example.com with 1.1.1.1", + "description": "Override a site'\''s IP address with another IP", + "enabled": true, + "action": "l4_override", + "filters": [ + "l4" + ], + "traffic": "net.dst.ip in {203.0.113.17} and net.dst.port == 80", + "identity": "", + "device_posture": "", + "rule_settings": { + "l4override": { + "ip": "1.1.1.1", + "port": 80 + }, + "override_host": "", + "override_ips": null + } +}' +``` + +