# Sessions between http and https

**URL:** <https://www.ruby-forum.com/t/sessions-between-http-and-https/173618>\
**Category:** Rails\
**Created:** [August 12, 2009, 4:39am UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618 "2009-08-12T04:39:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [August 12, 2009, 4:39am UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618/1 "2009-08-12T04:39:19Z")

</div>

I have an online store I created and I’ve been saving a  
“shopping\_cart\_id” in the session which references a data object.

I added “ssl\_requirement” to the site and I put the Order Summary,  
Checkout, and Confirm pages behind SSL. The only problem is that the  
Order Summary page needs that session from “http” to access the  
shopping cart data.

Is there a way to persist the session between http and https?

Or should I simply put all shopping cart actions behind SSL?

Or can I use “active\_record\_store” to solve my problems?

Any advice would be much appreciated.

Thanks,  
Andy

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [August 12, 2009, 5:06am UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618/2 "2009-08-12T05:06:13Z")

</div>

On Tue, 2009-08-11 at 19:38 -0700, Andy wrote:

> Or can I use “active\_record\_store” to solve my problems?

Yes.

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [August 12, 2009, 2:11pm UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618/3 "2009-08-12T14:11:46Z")

</div>

I switched to active\_record\_store and I took my shopping cart out from  
behind SSL.

I’m creating session[:shopping\_cart\_id] WITHOUT SSL

But when I try to access session[:shopping\_cart\_id], I’m getting an  
error.

Any ideas?

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [August 12, 2009, 2:22pm UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618/4 "2009-08-12T14:22:19Z")

</div>

After a little digging, I discovered that if I have the page with the  
form to ADD to the shopping cart NON-SSL, and I submit a form to an  
SSL page, I lose the form data.

Given that, I MUST put my shopping cart on a NON-SSL page…

But I still don’t know how to persist the shopping cart between HTTP  
AND HTTPS.

Any ideas?

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [August 14, 2009, 2:24pm UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618/5 "2009-08-14T14:24:27Z")

</div>

Any ideas anyone?

Can I access the session between SSL and non-SSL?

Thanks,  
Andy

---

<div class="post-metadata">

**Author:** ![andy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@andy](https://www.ruby-forum.com/u/andy)\
**Post date:** [August 14, 2009, 2:46pm UTC](https://www.ruby-forum.com/t/sessions-between-http-and-https/173618/6 "2009-08-14T14:46:41Z")

</div>

Andy wrote:

> Any ideas anyone?
> 
> Can I access the session between SSL and non-SSL?
> 
> Thanks,  
> Andy

If you get no help from here, you should go ask on freenode’s  
rubyonrails channel… There’s a couple of really competent rails guys  
there who are usually quite helpful.
