CNAME and A Record Question

Hey All!
I am pretty new DNS settings and having a question about CNAME and A records. So I am running dokku on a cloud server and have some apps deployed. I understand how to make A records. Like example.krischomat.de. But I want that www.krischomat.de and krischomat.de are pointing to my website. But when I use one of these urls for my app the other one just goes to the root of my server. How can I mange that both versions with and without www is going to one site?

The Origin server needs to know about hostname that is pointing to it. It looks like your www hostname is not configured on the server, and you are getting a default virtual host.

The usual way to configure this is to decide if you want www or not, and create a redirect in the appropriate direction. As your site appears to work (at least with a Hello World) on the non-www version, you can create a redirect from www.krischomat.de to krischomat.de. Having one URL as the canonical address will improve SEO, cache performance etc.

You can do this redirect with Bulk Redirects, or with a Page Rule as described here:

https://developers.cloudflare.com/pages/how-to/www-redirect/

Ah Great! Yes this works! Thanks for the fast reply. so now www.krischomat.de goes to https://krischomat.de. When I want the address with “www” to be the lets say default one will I set the domain of my app to the “www” one and redirect to that one?

Okay I was switching from the hello-world example to my “real” page. So I was able to have now this domain with and without www always going to www.christian-grothe.com. Before I had this address I used christian-grothe.krischomat.de and I created another rule to redirect this to the new url. But I am getting a security issue now. What can I do about this?

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