Forums

Cloudflare DNS wrong setup.

So I had some trouble with the DNS from Cloudflare. First I pointed the www name to my web app and then the "domainname.com" name to redirect to "www.domainname.com". I think that was the wrong approach, but it was something I had done previously on Heroku and seemed to work.

Now, this setup didn't work and I could visit the "www" page, but not the naked domain page ("@"). I tried switching them around and pointing "www" to "@" and changed my pythonanywhere to "domainname.com", which resulted in "domainname.com" being resolved and not "www.domainname.com"

So, finally, I have only 1 name "www" pointing to the web app.

The problem is that, now, when I visit "www.domainname.com", I get redirected to "www.domainname.com/www.domainname.com/" (wtf).

Also I defined a page rule that redirects from "https://domainname.com/*" to "https://www.domainname.com/$1" like this page suggests https://support.cloudflare.com/hc/en-us/articles/224509547

I though that might be the problem but I turned off the rule and it still happens.

Why is that happening and how can I fix it? Seems like a weird error.

Also, what can I do to redirect from "domainname.com" to "www.domainname.com"?

The initial setup that you described should work; you need a CNAME to point www.domainname.com to the webapp-XXXX.pythonanywhere.com value that we provide, and then a redirection from @ (which means the naked domain) to www.domainname.com. The latter would be done with a page rule like the one you describe (with the link to the Cloudflare docs).

Perhaps you could post a screenshot of your current settings?

Yeah sure, sorry for the late reply, here is the picture of the DNS

So my main problem is that I get redirected from "www.domainname.gr/el" to "www.domainname.gr/el/www.domainname.gr". I don't think it's a code problem because it works on localhost, but I am not sure. I also deleted the page rules and it still happens.

The dns

The above DNS setup seems right but doesn't do what I wanted. When I try to resolve "domainname.gr" I get a pythonanywhere coming soon page, but www works.

CNAMEs don't support naked domains, you should point to your web app, which is at www.hebecosmetics.gr and set up a redirect at your registrar, see: https://help.pythonanywhere.com/pages/NakedDomains/.