Rails cookie session sharing and "www.example.com" or "example.com" problem
Posted
by Rafael Mueller
on Stack Overflow
See other posts from Stack Overflow
or by Rafael Mueller
Published on 2009-02-27T20:18:52Z
Indexed on
2010/04/06
8:33 UTC
Read the original article
Hit count: 664
ruby-on-rails
|apache
When people access my app on www.example.com and log in, they get a cookie. I'm using the cookie option to store session on Rails. Accessing example.com (without the www), they must log in again, because Firefox does not recognize the previous session.
So, what do you think is the best way to avoid this?
I guess I will use a small .htaccess
rule (Apache + Passenger) like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
Do you guys think that is a good solution?
© Stack Overflow or respective owner