Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
There is no such DNS record called ALIAS, can you clarify what that is? –  milli Feb 17 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 at 4:00
    
Ok, I see. ALIAS is something dnssimple invented. It's generating an A record in reality. –  milli Feb 22 at 22:20

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks, I will look into my cookie store –  marflar Feb 15 at 22:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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