Bobcares

Auth0 Cloudflare

by | May 30, 2022

Auth0 Cloudflare supports us in protecting against network-based attacks.

Bobcares responds to all inquiries, large and small, as part of our Server Management Service.

Let’s take a look at how our Support team explained the Auth0 Cloudflare.

Auth0 Cloudflare

We only need to add a CNAME record to the domain if we want Auth0 to manage the certificates for our custom domain. On Auth0 servers, the record is validated and the certificate is generated. These certificates are automatically renewed every three months. We can easily configure this, and we won’t have to manage the certificates ourselves.

Configure Cloudflare as Reverse Proxy

A Cloudflare Enterprise Plan with the following features is required to set up Cloudflare as a reverse proxy:

  • Host Header Override
  • True-Client-IP Header

Auth0 advises against using CNAME flattening unless absolutely necessary. CNAME flattening for Auth0 managed certificates is an unsupported configuration that may cause the custom domain to break unexpectedly if enabled. Consider delegating the subdomain for Auth0 to another DNS provider if we need to enable CNAME flattening for all subdomains managed by Cloudfare as well as configure a specific subdomain to be an Auth0 custom domain. This allows us to use CNAME flattening for all subdomains except Auth0.

  1. Firstly, if we haven’t already, configure Custom Domains with Self-Managed Certificates. Keep track of the Origin Domain Name and cname-api-key values because we’ll need them later.
  2. Then, configure a Cloudflare CNAME setup.
  3. Log in to the Cloudflare Dashboard once the domain has been verified by Cloudflare.
  4. Then, Create a new Cloudflare Page Rule.
  5. Finally, Using the following script, create and deploy a new Cloudflare Worker for the configured CNAME.
    addEventListener('fetch', event => {
        event.respondWith(handleRequest(event.request))
    })
    
    async function handleRequest(request) {
        request = new Request(request)
        request.headers.set('cname-api-key', '<YOUR_CNAME_API_KEY>')
        return await fetch(request)
    }
    

    We should replace with the cname-api-key we received from Auth0.

Configure Auth0

Use the following in the body of the Management API Update Custom Domain Configuration patch endpoint:

{
  "tls_policy": "recommended",
  "custom_client_ip_header": "true-client-ip"
}

Setup Custom Domains Using Auth0-Managed Certificates

To use Auth0-managed certificates to set up our custom domain, we must first provide Auth0 with our domain name and verify that we own it. Once verified, we must configure our Auth0 features in order to begin using our custom domain.

Provide the domain name to Auth0

  1. Firstly, navigate to Dashboard > Settings > Custom Domains or Dashboard > Branding > Custom Domains to get started.
  2. Then, in the provided box, enter the custom domain and select Auth0-managed certificates.
  3. Finally, select Add Domain. Even though the Add Domain button remains visible after we add a domain, we can only add one domain per tenant.

Verify ownership

We’ll need to verify that we own the domain before we can use it with Auth0.

  • Firstly, Go to Dashboard > Branding > Custom Domains.
  • Then, add the CNAME verification record from the Dashboard to the DNS record for our domain.
  • Finally, to proceed, click Verify.

Depending on our DNS settings, it may take a few minutes for Auth0 to verify the CNAME record. If Auth0 was successful in verifying our domain name, a confirmation window will appear. This means that the verification process is complete, and our custom domain should be ready to use in 1 to 2 minutes.

Add CNAME verification record to DNS record

To avoid issues during certificate renewal, the CNAME record must be present at all times once added. Consider delegating the subdomain for Auth0 to another DNS provider if we need to enable CNAME flattening for all subdomains managed by Cloudfare and also configure a specific subdomain to be an Auth0 custom domain. This will allow us to use CNAME flattening for all subdomains except Auth0.

The following steps may differ depending on our domain host provider.

  1. Firstly, sign in to the domain management service.
  2. Then, create a new record.
  3. Finally, save the record.

If Auth0 was successful in verifying our domain name, a confirmation window will appear. This means that the verification process is complete, and our custom domain should be ready to use in 1 to 2 minutes.

We may need to repeat these steps if we are unable to complete the verification process.

[Looking for a solution to another query? We are just a click away.]

Conclusion

To sum up, our Support team explained the Auth0 Cloudflare.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.