How to Set Up a Custom Domain in Odoo Online Using Cloudflare

If you have created your website using Odoo Online, you might want to use your own custom domain to point to that website.

We typically use Cloudflare for domain management, so this guide will primarily reference Cloudflare. However, the same steps generally apply to other domain providers as well, with minor variations depending on their user interfaces.

Set Up a CNAME Record

To point your domain to Odoo Online, the first step is to configure a CNAME record in your domain manager, Cloudflare in our case.

If you're using Cloudflare:

  1. Log in to your Cloudflare dashboard.
  2. Select your domain.
  3. Go to the DNS​ section in the left-hand menu.
  4. Under Records, click on Add Record​ and enter the following details:
  • Type: CNAME
  • Name: www​ 
  • Target: mydomain.odoo.com
  • Proxy Status: DNS Only

This setup means that www.mydomain.com​ will point to mydomain.odoo.com​, where mydomain.odoo.com​ is the default address you used to access your Odoo instance before setting up a custom domain. Please note that DNS changes may take some time to propagate.

Redirect Root Domain to WWW

To redirect mydomain.com​ (non-www) to your website at www.mydomain.com​, you will need to create a redirect rule in Cloudflare. For this to work, a proxied DNS record is required.

Add an A​ record as follows:

  • Type: A
  • Name: @​ or mydomain.com
  • Target: 192.0.2.1​ 
  • Proxy Status: Proxied

The IP address 192.0.2.1​ is reserved for documentation purposes but is valid in Cloudflare’s configuration. No traffic is actually routed to this IP. Cloudflare will handle the redirection before the traffic reaches that point.

Configure Page Rules

  1. Go to the Rules section in Cloudflare.
  2. Use the Redirect Root to WWW​ template to create a rule that redirects mydomain.com​ to www.mydomain.com​.
  3. Create another rule using the Redirect HTTP to HTTPS​ template to enforce HTTPS.

Alternatively, instead of a rule, you can enable, Always Use HTTPS​. Go to SSL/TLS > Edge Certificates​ and enable the toggle.

Link Your Domain in Odoo

  1. Go to your Odoo Online database.
  2. Click on your database name.
  3. Select Domain Names​.
  4. Click Use My Own Domain​.
  5. Enter www.mydomain.com​ and click Verify​.

If the DNS records are correctly configured and resolved, Odoo will verify the domain. You will then need to wait a short while for Odoo to generate an SSL certificate.

Once the SSL certificate is issued, you can safely set the SSL/TLS encryption mode in Cloudflare to Full (strict)​.

At this point, your website will be accessible from both mydomain.com​ and www.mydomain.com​ .