Test a policy
Last updated Oct 12, 2026 It is common for a misconfigured Gateway policy to accidentally block traffic to benign sites. To ensure a smooth deployment, we recommend testing a simple policy before deploying DNS filtering to your organization.
Test a policy in the browser
- Go to Traffic policies > Firewall policies.
- Turn off all existing DNS policies.
- Turn on any existing security policies or create a policy to block all security categories:
| Selector | Operator | Value | Action |
|---|---|---|---|
| Security Categories | in | All security risks | Block |
| 4. Ensure that your browser is not configured to use an alternate DNS resolver. For example, Chrome has a Use secure DNS setting that will cause the browser to send requests to 1.1.1.1 and bypass your DNS policies. | |||
5. In the browser, go to malware.testcategory.com. Your browser will display: |
|||
| - The Gateway block page, if your device is connected through the Cloudflare One Client in Traffic and DNS mode. | |||
| - A generic error page, if your device is connected through another method, such as DNS only mode. |
Note
Custom block pages require you to install a root certificate on the device.
- In Logs > Gateway > DNS, verify that you see the blocked domain.
- Slowly turn on or add other policies to your configuration.
- When testing against frequently-visited sites, you may need to clear the DNS cache in your browser or OS. Otherwise, the DNS lookup will return the locally-cached IP address and bypass your DNS policies.
You have now validated DNS filtering on a test device.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-dns-policies/test-policy/#page","headline":"Test a policy","description":"Test Gateway DNS policy enforcement.","url":"https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-dns-policies/test-policy/","inLanguage":"en","image":"https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-dns-policies/test-policy/og.png?v=9da21015b23c77ae","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: Secure Internet traffic and SaaS apps. title: Control traffic egress with source IP anchoring and allowlisting image: https://developers.cloudflare.com/learning-paths/secure-internet-traffic/build-egress-policies/og.png?v=6610a63b7a1df219
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