# Sessions not persistent across http-\>https

**URL:** <https://www.ruby-forum.com/t/sessions-not-persistent-across-http-https/87927>\
**Category:** Rails\
**Created:** [March 6, 2007, 11:46pm UTC](https://www.ruby-forum.com/t/sessions-not-persistent-across-http-https/87927 "2007-03-06T23:46:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clever\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@Clever\_N](https://www.ruby-forum.com/u/Clever_N)\
**Post date:** [March 6, 2007, 11:46pm UTC](https://www.ruby-forum.com/t/sessions-not-persistent-across-http-https/87927/1 "2007-03-06T23:46:47Z")

</div>

So, I turned on our SSL support (apache and mongrel all configured  
like they should be, forwarding the protocol header and all that).

Now, here is the problem: whenever I switch between SSL and non-SSL  
pages, the session gets lost, and I am issued a new session\_id cookie  
with a different value.

After some googling, I found this line to add to my environment.rb  
line:

ActionController::CgiRequest::DEFAULT\_SESSION\_OPTIONS.update(:session\_domain  
=\> ‘.mydomain.com’)

When I add that line, the session is _never ever_ kept, and I am never  
actually logged in to the application. I get instant redirects back  
to the login page, because the session is lost.

So, what magical words do I need to put in my config files to make  
these sessions persistent like they should be? Is this code maybe for  
older version of RAILS?
