Skip to content

Commit f442cc4

Browse files
committed
Add non-HTTP traffic policy
1 parent 367e3f3 commit f442cc4

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/content/docs/learning-paths/secure-internet-traffic/build-network-policies/recommended-network-policies.mdx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,56 @@ resource "cloudflare_zero_trust_gateway_policy" "all_net_ssh_internet_allowlist"
312312

313313
Block all non-web traffic towards the Internet. By using the **Detected Protocol** selector, you will ensure alternative ports for HTTP and HTTPS are allowed.
314314

315+
<Tabs syncKey="dashPlusAPI">
316+
317+
<TabItem label="Dashboard">
318+
315319
| Selector | Operator | Value | Logic | Action |
316320
| ----------------- | ----------- | ----------------- | ----- | ------ |
317321
| Destination IP | not in list | _InternalNetwork_ | And | Block |
318322
| Detected Protocol | not in | _HTTP_, _HTTP2_ | | |
319323

324+
</TabItem>
325+
326+
<TabItem label="API">
327+
328+
```sh
329+
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules \
330+
--header "Content-Type: application/json" \
331+
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
332+
--data '{
333+
"name": "All-NET-NO-HTTP-HTTPS-Internet-Deny",
334+
"description": "Block all non-web traffic towards the Internet",
335+
"precedence": 0,
336+
"enabled": true,
337+
"action": "block",
338+
"filters": [
339+
"l4"
340+
],
341+
"traffic": "not(net.dst.ip in $<INTERNAL_NETWORK_IP_LIST_UUID>) and not(net.detected_protocol in {\"http\" \"http2\"})"
342+
}'
343+
```
344+
345+
</TabItem>
346+
347+
<TabItem label="Terraform">
348+
349+
```tf
350+
resource "cloudflare_zero_trust_gateway_policy" "all_net_no_http_https_internet_deny" {
351+
account_id = var.account_id
352+
name = "All-NET-NO-HTTP-HTTPS-Internet-Deny"
353+
description = "Block all non-web traffic towards the Internet"
354+
precedence = 0
355+
enabled = true
356+
action = "block"
357+
filters = ["l4"]
358+
traffic = "not(net.dst.ip in ${"$"}${cloudflare_zero_trust_list.internal_network_ip_list.id}) and not(net.detected_protocol in {\"http\" \"http2\"})"
359+
}
360+
```
361+
362+
</TabItem>
363+
</Tabs>
364+
320365
## All-NET-InternalNetwork-ImplicitDeny
321366

322367
Implicitly deny all of your internal IP ranges included in a list. We recommend you place this policy at the [bottom of your policy list](/learning-paths/secure-internet-traffic/understand-policies/order-of-enforcement/#order-of-precedence) to ensure you explicitly approve traffic defined in the above policies.

0 commit comments

Comments
 (0)