views:

63

answers:

2

My rails site posts to a secure host (e.g. 'https://secure.yourname.com') when the user logs into the site. Session data is stored in the database, with the cookie containing only the session ID. The problem is that when the user returns to a non-https page, such as the home page (e.g. 'http://www.yourname.com') the user appears to have logged out. I believe the reason for this is that a separate cookie is stored for each host (www vs. secure). Is this correct?

What is the best secure way to persist the session between both the http and https sections of the site? Does anyone know of any plugins that address this problem?

The site runs on Heroku.

A: 

It sounds like the cookie is being set with domain=secure.yourname.com. It needs to be domain=.yourname.com.

In Firefox, you can view the cookies set by the current website: Tools -> Page Info -> Security -> View Cookies

I don't know how to make this change in Horoku. I suggest searching for "Heroku cookie subdomain".

James Roth
A: 

This answered my question: http://bit.ly/cs9syy

Matt