Using Cloudflare domains with Dub

Learn how to use Cloudflare domains for your Dub workspace

Steven Tey

Written by Steven Tey

Prerequisites

If you're using a domain on Cloudflare for your Dub workspace, you might need to configure a few extra steps to make sure that your domain works properly.

We recommend using Cloudflare's DNS only mode for your custom domain. This makes sure that requests/clicks to your short links will always reach Dub directly instead of being served through Cloudflare – which can lead to inaccurate analytics data.

Configuring Cloudflare as DNS only is also better for redirect speeds, since you avoid having your users' requests get proxied through Cloudflare, which adds additional latency.

To set this up, all you need to do is set your domain's DNS records to point to Dub's servers and make sure that you're using the DNS only option on Cloudflare.

  1. Go to your Cloudflare dashboard and select your domain.
  2. Click on the DNS tab on the sidebar menu.
  3. Under Records, click on the Edit button.
  4. Change the Proxy status to DNS only.
  5. Click on the Save button.

This will make sure that the traffic to your domain is not proxied through Cloudflare and is sent directly to Dub.

Using Cloudflare's Proxy

If you really want to use Cloudflare's proxy for your custom domain, you'll need to make sure that your SSL/TLS encryption mode is set to "Full" on Cloudflare.

You can do that by following these steps:

  1. Go to your Cloudflare dashboard and select your domain.
  2. Click on the SSL/TLS tab on the sidebar menu.
  3. Under Overview, click on the Configure button.
  4. Select the Custom SSL/TLS option and then select the Full option.
  5. Click on Save to apply the changes.

Using Cloudflare's Proxy can potentially cause inaccuracies in analytics data. This is because using a proxy will send all traffic through the proxy first, then to Dub. This will result in incorrect geolocation data being presented and the public IP address of your proxy being sent.


To avoid this, we recommend using Cloudflare's DNS only mode instead of using their proxy.

Did this answer your question?