Sessions not persisting through requests 5.0.0beta1 #1310

Closed
TheNaoX opened this Issue Dec 2, 2014 · 9 comments

Projects

None yet

3 participants

@TheNaoX
TheNaoX commented Dec 2, 2014

Hi guys,

I've been playing with passenger 5 beta with a Rails application for a week now and I just noticed that the Rack session variables are not persisting through requests (including cookies) and I don't know why this is happening, I've been reading a lot the documentation you have but It doesn't really cover that scenario, I tried to change the --spawn-method to direct and it doesn't work anyway.

I thought it was a design issue of my application, however, all my spec files are working properly and it also works if I use WEBrick or any other web server.

Thanks in advance!

@FooBarWidget
Member

Rails sessions are stored in cookies by default, and 5.0.0 beta 1 has a known bug related to cookie handling: #1296
It should work if you try the version from git master.

@TheNaoX
TheNaoX commented Dec 2, 2014

Thanks so much for your response, I'll use the master branch as reference and let you know if it worked

@TheNaoX
TheNaoX commented Dec 2, 2014

Unfortunately it's not working, I set a value in a Rails controller like this:

# Controller details not necessary
def index
  session[:foo] = "bar"
end

And then in another controller context:

# Controller details not necessary
def create
  if session[:foo] == "bar"
    # ...
  end
end

But it returns:

session[:foo]
# => nil

Instead of:

session[:foo]
# => "bar"

And it works perfectly fine with other web servers such as WEBrick, Please let me know if I am missing something.

Thanks.

@FooBarWidget FooBarWidget added this to the 5.0.0 beta 2 milestone Dec 3, 2014
@FooBarWidget
Member

Let me investigate this then.

@FooBarWidget
Member

I can't reproduce this problem. Both sessions and cookies work perfectly for me, using the latest git master.

Could you use the browser's dev tools to capture some network traffic and show me the request and response headers that are being sent?

@TheNaoX
TheNaoX commented Dec 18, 2014

I'll do that and give you the information you need, thanks!

@TheNaoX
TheNaoX commented Dec 19, 2014

Hi @FooBarWidget here's the whole session on each response, I just updated to 5.0.0.beta2 this morning and the session values that I set manually seem to work, but the devise sessions are not persisting when I'm trying to authenticate, hopefully this will give you enough information for what you need. As additional information Devise sessions were persisting fine in 5.0.0.beta1

Remote Address:127.0.0.1:3000
Request URL:http://lvh.me:3000/demo/product_launch/status
Request Method:GET
Status Code:200 OK

Request Headers

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,es-419;q=0.6,es;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Cookie:__ngDebug=true; fbm_261680850639195=base_domain=.lvh.me; mp_acbb4e808cfe9d10b1e1bc12804f741e_mixpanel=%7B%22distinct_id%22%3A%20%2214a0d4c1e6d323-0e838e91c-1a3a6b5e-1fa400-14a0d4c1e6e4ff%22%2C%22%24initial_referrer%22%3A%20%22http%3A%2F%2Flvh.me%3A3000%2Fdemo%2Fproduct_launch%2Fqueue%22%2C%22%24initial_referring_domain%22%3A%20%22lvh.me%3A3000%22%2C%22__alias%22%3A%20%2254863fca4a756113e8320000%22%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpap%22%3A%20%5B%5D%7D; fbsr_261680850639195=XyuiOCGzUs4GZkKylCBdYOFyQ5X0YRTnEhkjDLkpAfI.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUURZbGdxTXd4RkFHVjVyQTZPWHZob3hnSzc5cnRvTndYMjI2TnRzVU5tMVhDV2dGdC1ZWUJheXE4Y2QzSndpdldzeXlFZlZrTDQzMGZuOXJyQUlOYi0yOWtTOVA5VldvX19aeXJVaHlxT21leHEtajRDX2JvNDlsZkt6ZXBPVEJ6VkQ1Y1J3WFZLMGZoZkkxYXFlVWxnT0JtNWMxdG1iUm5FSFdnV0kyTGJBN19VS0lTU19MT25RY2QzSlpfdlExbkM1Z2JaSzRMUFI5OEU3bENBWVo0NlgxTlZRMmNqZHVSQVIwM1o1ZnJZZDdvV1p0Yko2OUExNUxqOG5LcjA1QUtWNlNqQUluQmNham1jTHZuYUFycHUxMmlqazdaS1BmWTY4Sml4SHdLTjFoQVVCQ3U3ekJaMzVkVXdRX1ZNc0FlaVh2aFhpWDBZV1prd3RkMDFuREdudSIsImlzc3VlZF9hdCI6MTQxOTAxNDkyOCwidXNlcl9pZCI6IjEwMDAwMDEwOTE1ODQ2MSJ9; last_product_page=http%3A%2F%2Flvh.me%3A3000%2Fdemo%2Fproduct_launch%2Fqueue; _queue_session=d3B2WWNtK2hxTm53U0g2TWF0K2dadTJGZDVqb1QwcVFQVit6QkZZYU02ampKeHAyTXhGbjBPbWN6MTJjcGZLdTNqMVZ1SmRvQXByUVBGM0l2NkQ1T1hkeHpONHdtSUUrZTUxQUJPWThnYndyY1NBcHlmYndPZElqWnk2TFVNYVhoSVV2ZnUwMlRJVGhDYURaOHhJdGlZazFlWVpoak5yY0JWaVhQNy9vaXcraCtZVXFaVVdhU1ZwQTU0ekxVdWNDUEYyL0V6V1N1NmQvdXVBMzEvQ2Y3QT09LS0vaXVLRlZUc2k1dERJaWdiT2U5cGZBPT0%3D--3ff00436d0d6c2f3f1b9ce8d15b21b15201b5b09
Host:lvh.me:3000
If-None-Match:"3a636fd9e77903b29b05b967cab1929d"
Referer:http://lvh.me:3000/demo/product_launch/status
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36

Response Headers

cache-control:max-age=0, private, must-revalidate
content-type:text/html; charset=utf-8
Date:Fri, 19 Dec 2014 18:56:22 -0600
etag:"268bb0a305f52a585493418b6b48b600"
Set-Cookie:_queue_session=TzZqeHhTK3dPUFA3c1FtQjhXdkpmcnNEZ2lFQ1lkSWFLRitBT2RxRHNyN2d0ZnlDbkVtUkd5UER3OGNsNVJKcEpFWC9VWitLK2doME0yTVB0RDFjSERCcUlhTGU4YU5WdmFGdTRvRngvMFpNeHZuNmtiYWpBck41T2xkbHNjcUJ1cG5IdVdueE8vQTRUSXhFUlIxcDYyRzlBbS9xM3hRZURmZGpGM0llT2pXVy9oU1hscFc2UTVyYm5PN3h0WEt1c2NUZmFpemdkQ1dTb0xYbE4yZzNpQT09LS1vSStsdllSc0xFaDgxdEVHS25CcDlBPT0%3D--cf70d10d8502591c6fd62bb31f8943c9855204e1; domain=lvh.me; path=/; HttpOnly
Status:200 OK
Transfer-Encoding:chunked
x-content-type-options:nosniff
x-frame-options:SAMEORIGIN
X-Powered-By:Phusion Passenger 5.0.0.beta2
x-request-id:16e2e85c-234e-4f97-b95e-0eb524b245bf
x-runtime:0.076766
x-xss-protection:1; mode=block
@tonilin
tonilin commented Dec 22, 2014

+1

There is two application on my server, redmine and a rails application with devise.

It works fine on redmine

But on the other application, I faced the same problem that I can not login.

@FooBarWidget
Member

Problem is fixed now. Thanks for all the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment