Recommended HTTP policies·续
resource "cloudflare_zero_trust_gateway_policy" "all_http_domainhost_blocklist" {
account_id = var.cloudflare_account_id
name = "All-HTTP-DomainHost-Blocklist"
description = "Block specific domains or hosts that are malicious or pose a threat to your organization"
precedence = 50
enabled = true
action = "block"
filters = ["http"]
traffic = "any(http.request.domains[*] in ${"$"}{cloudflare_zero_trust_list.domain_blocklist.id}) or http.request.host in ${"$"}{cloudflare_zero_trust_list.host_blocklist.id} or http.request.host matches \".*example\\.com\""
}
All-HTTP-Application-Blocklist
Block unauthorized applications to limit your users' access to certain web-based tools and minimize the risk of shadow IT. For example, the following policy blocks known AI tools:
| Selector | Operator | Value | Action |
|---|---|---|---|
| Application | in | Artificial Intelligence | Block |
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "All-HTTP-Application-Blocklist",
"description": "Limit access to shadow IT by blocking web-based tools and applications",
"precedence": 60,
"enabled": true,
"action": "block",
"filters": [
"http"
],
"traffic": "any(app.type.ids[*] in {25})",
"identity": "",
"device_posture": ""
}'
resource "cloudflare_zero_trust_gateway_policy" "all_http_application_blocklist" {
account_id = var.cloudflare_account_id
name = "All-HTTP-Application-Blocklist"
description = "Limit access to shadow IT by blocking web-based tools and applications"
precedence = 60
enabled = true
action = "block"
filters = ["http"]
traffic = "any(app.type.ids[*] in {25})"
identity = ""
device_posture = ""
}
PrivilegedUsers-HTTP-Any-Isolate
Isolate traffic for privileged users who regularly access critical systems or execute actions such as threat analysis and malware testing.
Security teams often need to perform threat analysis or malware testing that could trigger malware detection. Likewise, privileged users could be the target of attackers trying to gain access to critical systems.
| Selector | Operator | Value | Action |
|---|---|---|---|
| User Group Names | in | Privileged Users | Isolate |
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "PrivilegedUsers-HTTP-Any-Isolate",
"description": "Isolate traffic for privileged users who regularly access critical or testing systems",
"precedence": 70,
"enabled": true,
"action": "isolate",
"filters": [
"http"
],
"identity": "any(identity.groups.name[*] in {\"Privileged Users\"})"
}'
resource "cloudflare_zero_trust_gateway_policy" "privileged_users_http_any_isolate" {
account_id = var.cloudflare_account_id
name = "PrivilegedUsers-HTTP-Any-Isolate"
description = "Isolate traffic for privileged users who regularly access critical or testing systems"
precedence = 70
enabled = true
action = "isolate"
filters = ["http"]
identity = "any(identity.groups.name[*] in {\"Privileged Users\"})"
}
Quarantined-Users-HTTP-Restricted-Access
Restrict access for users included in an identity provider (IdP) user group for risky users. This policy ensures your security team can restrict traffic for users of whom malicious or suspicious activity was detected.
| Selector | Operator | Value | Logic | Action |
|---|---|---|---|---|
| Destination IP | not in list | Quarantined-Users-IPAllowlist | And | Block |
| User Group Names | in | Quarantined Users |
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "Quarantined-Users-HTTP-Restricted-Access",
"description": "Restrict access for users included in an identity provider (IdP) user group for risky users",
"precedence": 80,
"enabled": true,
"action": "block",
"filters": [
"http"
],
"traffic": "not(any(http.conn.dst_ip[] in $<QUARANTINED_USERS_IP_ALLOWLIST_UUID>))",
"identity": "any(identity.groups.name[] in {\"Quarantined Users\"})"
}'
resource "cloudflare_zero_trust_gateway_policy" "quarantined_users_http_restricted_access" {
account_id = var.cloudflare_account_id
name = "Quarantined-Users-HTTP-Restricted-Access"
description = "Restrict access for users included in an identity provider (IdP) user group for risky users"
precedence = 80
enabled = true
action = "block"
filters = ["http"]
traffic = "not(any(http.conn.dst_ip[*] in ${"$"}{cloudflare_zero_trust_list.quarantined_users_ip_allowlist.id}))"
identity = "any(identity.groups.name[*] in {\"Quarantined Users\"})"
}
All-HTTP-Domain-Isolate
Isolate high risk domains or create a custom list of known risky domains to avoid data exfiltration or malware infection. Ideally, your incident response teams can update the blocklist with an API automation to provide real-time threat protection.
| Selector | Operator | Value | Logic | Action |
|---|---|---|---|---|
| Content Categories | in | New Domains, Newly Seen Domains | Or | Isolate |
| Domain | in list | Domain Isolation |
Create a Zero Trust Gateway rulebash
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/gateway/rules" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "All-HTTP-Domain-Isolate",
"description": "Isolate high risk domains or create a custom list of known risky domains to avoid data exfiltration or malware infection",
"precedence": 90,
"enabled": true,
"action": "isolate",
"filters": [
"http"
],
"traffic": "any(http.request.uri.content_category[*] in {169 177}) or any(http.request.domains[*] in $<DOMAIN_ISOLATE_LIST_UUID>)"
}'
resource "cloudflare_zero_trust_gateway_policy" "all_http_domain_isolate" {
account_id = var.cloudflare_account_id
name = "All-HTTP-Domain-Isolate"
description = "Isolate high risk domains or create a custom list of known risky domains to avoid data exfiltration or malware infection"
precedence = 90
enabled = true
action = "isolate"
filters = ["http"]
traffic = "any(http.request.uri.content_category[*] in {169 177}) or any(http.request.domains[*] in ${"$"}{cloudflare_zero_trust_list.domain_isolate_list.id})"
}
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-http-policies/recommended-http-policies/#page","headline":"Recommended HTTP policies","description":"Deploy recommended HTTP security policies.","url":"https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-http-policies/recommended-http-policies/","inLanguage":"en","image":"https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-http-policies/recommended-http-policies/og.png?v=23da7184286717e8","dateModified":"2026-10-12","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Enable and configure TLS decryption. title: Use TLS inspection image: https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-http-policies/tls-inspection/og.png?v=8ed78dc8887a5899
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/learning-paths/llms.txt
Use this file to discover all available pages before exploring further.
Docs