If I visit http://mysite.com I find that I am logged in. But if I visit http://www.mysite.com I find I am not logged in.

I have the following in my DNS:

ALIAS   mysite.com.  mysite.herokuapp.com.        
CNAME   www.mysite.com.  mysite.herokuapp.com.        
NS          mysite.com.  dns1.pointhq.com.      
NS          mysite.com.  dns2.pointhq.com.      
NS          mysite.com.  dns3.pointhq.com.      
NS          mysite.com.  dns4.pointhq.com.      
NS          mysite.com.  dns5.pointhq.com.

I'm obviously doing something wrong. My site is hosted on Heroku, and they don't let you use IP addresses on the naked domain. DNS is provided by pointhq.

Why is this happening? Should my CNAME be pointed at my ALIAS instead of at mysite.herokuapp.com? Could that be it? I can tinker around with it but the TTL is quite high.

Also, I don't think I want to go down the 301 redirect route because we're about to start using SSL.

  • There is no such DNS record called ALIAS, can you clarify what that is? – milli Feb 17 '14 at 3:21
  • @milli there is such a thing as an ALIAS. Some hosts don't let you point an A Record at their IP, so a few DNS hosts will let you create an ALIAS, which is like a CNAME, you can point it at a URL. I fixed my problem by telling my app to use all domains for cookies and sessions, as suggested in the accepted answer. – marflar Feb 17 '14 at 4:00
  • Ok, I see. ALIAS is something dnssimple invented. It's generating an A record in reality. – milli Feb 22 '14 at 22:20

This is not a problem related to DNS (as you can get to the site with either www or without it - all that the DNS server does in this regard).

Rather, the problem is with the way cookies work. The cookies are obviously not valid for a subdomain when you use the main domain. How (and if you can fix this is up to your software (and your browser). Redirects are probably the easiest, but I see your comment about not wanting to do them.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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