2

I have a domain for our company (example.com) and several subdomains for our clients (yyy.example.com). I have the A record for all of them pointing to the same IP. I have the www CNAME records pointing to their relative domain: www.example.com points to example.com www.yyy.example.com point to yyy.example.com

The following URLs work as expected:

  • example.com
  • www.example.com
  • yyy.example.com

BUT the problem is that when I try to use:

  • www.yyy.example.com it goes to www.example.com instead of going to yyy.example.com
  • The CNAME record for www.yyy.example.com is pointing to yyy.example.com so I don't know WHY it's not working as expected.

Pinging to all of the possible domains/subdomains resolve to the same IP.

My DNS provider (IPLAN from Argentina) says that the records are OK and everything is as expected and they say that the problem is... the hosting. The hosting (Odoo) says that the problem is... the DNS records.

1
  • 2
    "Can somebody point me in the right direction?" Give the real names involved, that would be the right direction. Else, ask your registrar and/or DNS provider for help. Or use online troubleshooting tools like DNSViz. Commented Aug 9, 2022 at 20:44

1 Answer 1

4

The problem is the hosting. DNS's one job is pointing names to IP addresses. You say that everything points to a single IP address, so DNS is doing its job correctly. From what you describe, the DNS is working.

On the hosting side, the server distinguishes between the host names from information sent by the browser, not from DNS records. If the server gets an HTTP request like:

GET /foo.html HTTP/1.1
Host: www.yyy.example.com

It should be using that Host: header to figure out which domain name it should be serving. This is set up on web servers through a mechanism called "virtual hosts". The virtual hosts on your server are misconfigured.

It looks like Odoo offers a variety of hosting packages and mechanisms. It is difficult to point you to documentation for configuring the virtual hosts without knowing exactly what type of hosting and what hosting package you have.

If I had to guess, it looks like www.example.com is configured as the first virtual host on your server and so it becomes the default virtual host. Then there are specific virtual hosts set up for example.com, www.example.com, and yyy.example.com. However, there is probably NO rule set up for www.yyy.example.com so it ends up falling back to the default. Fixing the problem could be as simple as adding more virtual hosts to your server. This is often accomplished by creating "add-on domains" in a web interface from the hosting service.

Part of the confusion stems from your misunderstaning about CNAME records. CNAME records are not redirects. CNAME records are more like name aliases that point a host name to the same IP address as some other record. However, they never cause URL changes (redirects). Only the web server can issue a redirect. DNS just doesn't have the power to do that.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.