Browsers can be configured to use any DNS over HTTPS (DoH) endpoint. If you choose to configure DoH directly in your browser, you must choose a Gateway location as your DoH endpoint, otherwise Gateway DNS filtering will not occur in that browser.Mozilla Firefox
In Firefox, go to Settings.
In the General menu, scroll down to Network Settings.
Select Enable DNS over HTTPS.
In the Use Provider drop-down menu, select Custom.
In the Custom field, enter https://<YOUR_DOH_SUBDOMAIN>.cloudflare-gateway.com/dns-query.
Enter about:config in the address bar.
Select Accept the risk! if you see a prompt from Firefox.
Set network.trr.bootstrapAddress to 184.108.40.206.
Set network.trr.mode to 3.
In Chrome, go to Settings > Privacy and security > Security.
Scroll down and turn on Use secure DNS.
Select With Custom.
In the Enter custom provider field, enter https://<YOUR_DOH_SUBDOMAIN>.cloudflare-gateway.com/dns-query.
In order to filter DoH queries based on user identity, each query must include a user-specific authentication token. If you have several devices per user and want to apply device-specific policies, you will need to map each device to a different email.
Currently, authentication tokens can only be generated through the API. You can run this interactive Python script which automates the setup procedure, or follow the steps described below.
Request a DoH token for the user, using your service token to authenticate into your team domain.
curl-s-X GET "https://<TEAM_NAME>.cloudflareaccess.com/cdn-cgi/access/doh-token?account-id=<ACCOUNT_ID>&user-id=<USER_ID>&auth-domain=<TEAM_NAME>.cloudflareaccess.com"\
The response contains a unique DoH token associated with the user. This token expires in 24 hours. We recommend setting up a refresh flow for the DoH token instead of generating a new one for every DoH query.Example response
If the site is blocked and you have enabled Display block page for the policy, the query will return 220.127.116.11 (the IP address of the Gateway block page). If the block page is disabled, the response will be 0.0.0.0.Example response
You can verify that the request was associated with the correct user email by checking your Gateway DNS logs. To filter these requests, build a DNS policy using any of the Gateway identity-based selectors.