Redirected naked url still seen by server as bare

I have a hosted account with Odoo, which doesn’t recognize naked urls as a matter of policy. Their documentation suggests simply creating 2 redirects like this:
CNAME www.mydomain.com => mydomain.odoo.com
CNAME mydomain.com => www.mydomain.com

Any www request works fine, but it seems that Cloudflare still sends naked requests to the server without converting it to www, so the server throws a 404.

I thought CNAME flattening would solve this. Is there anything I’m missing here? Is there some other way to make the server think the request is coming from “www”?

Any suggestions would be much appreciated.

Those aren’t redirects. They’re aliases. Effectively, instead of entering an IP address for that hostname, you enter another hostname. But your browser will still request a URL that doesn’t have ‘www’ in it and that just gets passed along to the server.

To get a real redirect, you need a Page Rule such as this:
Match: example.com/*
Setting: Forwarding URL (301) to https://www.example.com/$1

1 Like

I appreciate the quick reply. Based on other research I already tried that as well without success. You’ve got me thinking maybe there was a conflict and I should only try one approach at a time. I will try again right now. Thanks!

1 Like

The forwarding doesn’t seem to be working at all. This should have been pretty simple, and I gave it hours to propagate.

sunradon.com/*
Forwarding URL (Status Code: 301 - Permanent Redirect, Url: https://www.sunradon.com/$1)

Any ideas?

Currently, only www.sunradon.com has a DNS record. You’ll have to add a DNS record for sunradon.com as well - and make sure it’s proxied :orange:.

1 Like

Yes! That was the missing piece! Thank you so much! :sweat_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.