12.11.2026

How to choose between DNS and HTTP filtering in Gateway

The difference between DNS and HTTP filtering in Gateway. How to prepare HTTPS inspection, set up exceptions and verify identities and rule order in a pilot.

Theo Marek

Theo Marek

Cloudflare Solutions Engineer at Integrity. Deploys DDoS protection, WAF and Zero Trust for companies in Czechia and Slovakia.

Blocking a malicious domain and blocking a single page inside a service people use are two different tasks. DNS filtering can handle the first. The second needs closer inspection of web traffic and more thorough preparation of company devices.

Cloudflare Gateway offers both layers. The choice depends on what you need to recognise in a request, how you bring traffic to the inspection point and which exceptions you can manage. You can start with a small pilot and one clear question, for example whether a particular group needs access to a whole domain or only to part of it.

  • A DNS rule decides based on the query for a domain name
  • An HTTP rule can work with a specific URL and other request attributes
  • TLS inspection, that is inspection of the encrypted connection, requires the device to trust the relevant certificate
  • Exceptions and rule order can change the outcome of the whole configuration

1. Decide exactly what you need to allow or block

DNS translates domain names into the addresses a device connects to. Gateway can evaluate this query and allow or block the domain according to policy. For basic restriction of known malicious domains it is a useful control point.

DNS, however, does not see the path behind the domain name. From a query for portal.example.com it cannot tell whether the user will then open a company guide or another part of the portal. A policy therefore cannot distinguish two documents on the same domain based on DNS alone.

The HTTP filtering documentation describes closer inspection of web requests. It lets you decide based on URLs, methods and other available attributes. For HTTPS traffic, though, the inspection layer must be able to read the corresponding encrypted data.

Before configuring, write the rule down as a concrete business need. "Employees must not visit known phishing domains" targets a different scope than "suppliers must not open this part of the portal". The more precise the brief, the less pressure there is for broad exceptions later.

Also distinguish access to a website from working with its content. Opening a page, uploading a file and sending sensitive data may require different controls. Check the availability of specific selectors and related features before you design the policy.

DNS filtering also does not replace inspection of all network connections. An application may use a known IP address or a previously obtained answer. When assessing protection, keep a blocked DNS query separate from the overall view of a device's traffic.

The outcome of the first decision should be a description of the object being controlled. Is it a whole domain, a specific URL, a certain group of users or a specific type of request? Only then choose the layer and the deployment method.

For every restriction, name the owner of the business requirement. The security team can propose a control, but the need for a service must be confirmed by the person responsible for that work. The rule can then be judged by its specific purpose and impact, instead of arguing about whether a website looks risky in general.

2. Start with a DNS policy and verify the actual path of the query

First determine where DNS queries will come from. These may be managed devices or a network location connected in a supported way. Creating a rule does not by itself mean that every laptop will start using it automatically.

On a test device, verify that queries actually pass through the intended service. Compare the result with the corresponding log entry in Gateway. If the query is not there, do not start by changing the block condition; fix the routing or resolver configuration first.

DNS policies combine conditions and an action. For the pilot, choose a narrow, verifiable scope and define the expected behaviour in advance. Choose the test domain safely and deliberately, not by opening a real phishing link on an ordinary work computer.

Also record the rule's priority and existing exceptions. Two policies that are each reasonable on their own can produce a surprising result in a shared order. A lower precedence number means higher priority, but in DNS processing the evaluation phase also matters.

Some rules work with data available before the domain is resolved, others with the resolver's answer. It is therefore not enough to read the order of a single list and assume it explains every case. When the result is unexpected, find out which rule and which phase actually made the decision.

After changing a policy, account for cached DNS answers. For repeated tests, record the cache state and how to refresh the query. Otherwise you may compare a new query with a previous answer and wrongly conclude that the rule does not work.

For a domain allowed across the board, always find out why the exception was created. It may be needed for a single business service but open up a wider scope. If you need finer distinction, use the HTTP layer for that task instead of further extending the DNS list.

Repeat the same test outside the office if employees work remotely. A configuration on the company network does not prove correct behaviour of a laptop on a home connection. Acceptance should cover both environments the policy is actually meant to protect.

3. For HTTPS inspection, prepare the client and a trusted certificate

Full inspection of HTTPS traffic needs more than a rule with a domain name. Traffic must pass through the relevant proxy and the device must trust the certificate used for inspection. Without these prerequisites, the encrypted URL path or the content of a request cannot be inspected reliably.

In a typical deployment on managed laptops, the Cloudflare One Client is used in the appropriate mode. The administrator also deploys the root certificate and turns on the required proxy and TLS decryption settings. The exact steps are always adapted to the operating system in use and the way devices are managed.

The TLS decryption documentation explains the principle and the requirements. During inspection, Gateway brokers two secure connections. The device must therefore trust the issuer of the certificate presented to it by the inspection layer.

Do not try to solve missing trust with instructions telling employees to ignore browser warnings. Verify that the certificate is installed correctly and that the specific application supports it. Applications with their own certificate store may need a different procedure than the system browser.

TLS inspection changes how the content of communication is handled. Before deployment, decide who manages the rules, who can read the available logs and what data the company needs to keep. Set the scope according to the actual security purpose and the organisation's internal rules.

Include representative applications in the pilot, not just one open web page. Verify sign-in to company services, file uploads and the desktop clients in use. The result in a regular browser may not match the behaviour of a standalone application.

Also record the state of devices that have not yet received the required certificate. Support must be able to tell this case apart from an error on the target website or a block by policy. That distinction shortens diagnosis and limits unnecessary exceptions created under operational pressure.

Certificate management continues after the first installation. Prepare a procedure for renewal, for changing the issuer used and for removing the configuration when a device is retired. The deployment record should show which devices have already taken the change and which still use the original state.

4. Describe every inspection exception as a specific decision

Some applications use certificate pinning, that is they expect a specific certificate or one of its properties. Others require mutual TLS authentication of client and server. Brokered inspection may be incompatible with their behaviour, so they need a separate assessment.

Create an exception for a known service and a documented reason. State the owner, the scope and the review date. Without this record, a temporary fix can become a permanent gap whose traffic nobody reviews any more.

The Do Not Inspect action changes more than how the encrypted connection is established. For matching traffic it ends further HTTP inspection and the related enforcement of rules. You can then no longer assume that the content of the same request is still checked by DLP (data loss prevention) or the Gateway antivirus feature.

Traffic exempted from HTTP inspection also does not have the same visibility in HTTP logs. This does not mean all other network controls are switched off automatically. That is exactly why you need to describe which layers of protection remain effective and which data will be available.

When fixing a problem, start from the smallest necessary scope. An exception for one specific hostname may be appropriate where excluding a whole category would remove too much inspection. Then verify every change on the intended service and outside it.

For each exception, also define how it will eventually be removed. This may be a change to the application, a newly supported configuration or the end of using the service. Without such a point, the list of exceptions grows without anyone reassessing whether they are needed.

Before a change, save the previous scope and the reason for the decision. If the exception does not solve the problem, revert it and continue diagnosing another cause. An ineffective exception left in place would only make the configuration harder to follow without bringing the intended operational benefit.

5. Verify user identity and the order of layers

For identity-based rules, Gateway needs to know which user the traffic belongs to. Routing DNS through a shared network location alone does not establish the identity of each employee. With a supported client deployment, verify the device registration and its sign-in.

Policies that use identity selectors require the One Client in Traffic and DNS mode. When selecting groups, distinguish identity provider groups from Access rule groups. They are different objects and a similar name is no proof of the same membership.

For testing, create a pair of accounts with different permissions. Both should open the same address from a comparably configured device. If they get the same result, check which identity and group Gateway actually recognised before changing the rule.

A membership change at the IdP may not take effect immediately in all active sessions. It depends on the synchronisation used and on re-authentication. Acceptance must therefore also include removing a permission and confirming the moment the change starts to apply.

The order of enforcement explains how the individual layers relate to each other. A DNS block can prevent a connection before the request ever reaches an HTTP rule. An HTTP allow rule therefore does not by itself remove an earlier DNS block.

When diagnosing, follow one path from the device to the target service. Write down the time, identity, domain and the expected decision of each layer. Such a record shows the exact place of the problem better than repeatedly moving rules around without a verified hypothesis.

If several administrators work at the same time, coordinate changes during testing. Otherwise the result may be affected by a change to another layer the tester does not know about. For each verification, also record the version or current form of the relevant rules.

6. End the pilot based on results, not on the number of rules created

Choose a group of users with a similar working environment and assign responsible support. Announce in advance what will change and where to report problems. A temporarily limited scope makes it possible to catch a wrong block without affecting the whole organisation.

For every required control, prepare an allowed and a blocked scenario. If an HTTP policy is meant to block a specific path, also verify another allowed path on the same website. Only this pair shows whether the rule is precise enough.

Besides the block result, track the operational impact. How many support requests did the change trigger, and which applications need an exception? Use your own measurements from the pilot, because the documentation alone does not show the impact on a specific company environment.

Prepare a rollback for each individual change and decide who may perform it. When there is a problem, roll back the specific policy or configuration whose impact you know. Switching off inspection across the board makes it impossible to assess the cause and can silently remove other protection.

Before expanding, verify that the features and logs you need match the plan you use. Check the client documentation and current support for business applications. The decision should be based on a specific configuration, not on the general label of a secure web gateway.

Bring in the next group only after the pilot's major issues are resolved. Keep the tests of the previous group so that a new exception does not break behaviour that has already been verified. Gradual expansion thus adds coverage while continuously checking the impact of changes.

For a technical consultation with Integrity, a list of business scenarios, test results and justified exceptions will help. With them, a routing problem can be told apart from an overly broad policy. The operational goal is clear: block a defined risk while keeping the specific work an employee needs to get done.

Sources