# Problem with set-cookie?

**URL:** <https://www.ruby-forum.com/t/problem-with-set-cookie/169752>\
**Category:** Rails\
**Created:** [June 8, 2009, 10:34am UTC](https://www.ruby-forum.com/t/problem-with-set-cookie/169752 "2009-06-08T10:34:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@joya](https://www.ruby-forum.com/u/joya)\
**Post date:** [June 8, 2009, 10:34am UTC](https://www.ruby-forum.com/t/problem-with-set-cookie/169752/1 "2009-06-08T10:34:59Z")

</div>

Hello everyone,

I’m a beginner in Ruby on Rails and I have a little problem when I  
update my application RoR in my server. Can you help me please?

My problem is:

When I code my application in my computer: It’s ok.  
When I update my application in my server I have a “bug” with cookies.

When a user come in my website for the first time, I initialize some  
cookies. But in my server I have a message in my page and the cookies  
isn’t initialize:

Set-Cookie: boite=1-2; path=/ Set-Cookie:  
\_mileva2\_session\_id=BAh7CDoPc2Vzc2lvbl9pZCIlMzAyYjdlMjNiMzg5MDZlM2I3OTZlYTY4MzZkYjdkMjciCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA6EF9jc3JmX3Rva2VuIjFHTDY3TmcvclhXeXIwTG5YcDlmbzBkOFU1eW1VQkNYNUVhU2d2Qm1DdUIwPQ%3D%3D–2ea57948c303a0b69628eb3b8798eba64ef4dd44;  
path=/; HttpOnly

It’s working perfectly in my computer and I searched the problem in  
different place but no result ☹

My version of rails is 2.3.2.

A fragment of my code where I initialize the cookies:

In welcome\_controller.rb

# 3 # Dans le cas oÃ¹ j’ai ni cookie, et que je suis pas logguÃ©

boite = Box.find( :all,  
:conditions =\> “capsules.admin = ‘1’ && boxes.user\_id = ‘0’”,  
:order =\> ‘position’,  
:group =\> ‘capsule\_id’,  
:joins =\> “inner join capsules on boxes.capsule\_id = capsules.id” )  
@box = boite

# Pour crÃ©er les starters et les closers

@number = 8 - boite.length

# Initialisation des cookies

cookies[:user] = ‘mileva’  
cookie\_text = “”  
j = 0  
for box in boite  
if(j \>= 1)  
cookie\_text = cookie\_text + “-”  
end  
cookie\_text = cookie\_text + box.capsule.id.to\_s  
j = j + 1  
end

cookies[:boite] = cookie\_text

You can see the error in www.mileva.eu (Warning, if you don’t visit for  
the first time, you have to clear your cookies)

Thank you and Have fun

Joachim

---

<div class="post-metadata">

**Author:** ![joya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@joya](https://www.ruby-forum.com/u/joya)\
**Post date:** [June 8, 2009, 6:41pm UTC](https://www.ruby-forum.com/t/problem-with-set-cookie/169752/2 "2009-06-08T18:41:11Z")

</div>

Your server is running an old version of Passenger (2.0.6); this is a  
known issue with that version and Rails 2.3.2. Upgrading to the latest  
Passenger will fix it.

–Matt J.

---

<div class="post-metadata">

**Author:** ![joya](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@joya](https://www.ruby-forum.com/u/joya)\
**Post date:** [June 8, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/problem-with-set-cookie/169752/3 "2009-06-08T19:17:59Z")

</div>

Thank you Matt, I will try it 🙂
