4

Webserver setup: nginx / thin / ruby-sinatra

I use session object from ruby to store various info and return to path

session[:username] = 'username' 
session[:token] = 'token'
session[:error] = '' 
session[:return_to] = '/start_page'

Problem1:

On my sever, if the client is IE, all the info in the session object is lost when I do a page reload. Firefox and Chrome work fine.

If I take the save web page code and put it on different server with the same setup, I dont have a problem at all. All 3 browsers(same client) work good and remember the sessions.

What could go wrong with the setup? Why only IE??

Problem2:

On my server, the session[:session_id] doesnt get initialized until I set some variable to the session, but if I run same code on a different server, the session[:session_id] is available on very first access.

Why there is different behavior for completely identical set ups??

Schu
  • 1,124
  • 3
  • 11
  • 23
  • Please upvote the question, if you view it and could not answer. It will lead to more views and possibly answers. Thanks. – Schu Oct 24 '11 at 17:14
  • 1
    Are you sure both setups have the same version of sinatra? Are they both running in the same mode? (production, development). Also, it might help if you show us some more of your code. For instance, I assume you're using Rack::Session::Cookie. What options are you passing it? – bioneuralnet Oct 24 '11 at 19:31
  • I dont know what the Rack::Session::Cookie is. Apart from the code in the Q, all I use is enable :sessions in ruby configure method. – Schu Oct 24 '11 at 20:30
  • I checked the versions of sinatra, I had 1.3.1 and other session remembering machines had 1.2.6. I changed mine to 1.2.6 all and IE starts working! Problem1 solved. thank you. – Schu Oct 24 '11 at 20:32
  • The question remains why would sinatra 1.3.1 forget sessions for IE, is it a bug or am I missing anything? – Schu Oct 24 '11 at 20:34
  • noticed this happening on IE8 but works on IE6 + IE7....not sure wtf is up – eyberg Nov 16 '11 at 01:18
  • Under a similar setup (Nginx as reverse-proxy to Thin+Sinatra) most of my apps work fine, but I've run into a situation with a new app where the session information keeps getting dropped on the floor even in 'sane' browsers like Chrome and Safari. More investigation needed, but it appears to be specific to Nginx and possibly related to XHR. – Phrogz Mar 07 '12 at 03:09

1 Answers1

0

Seems to be a bug with sinatra 1.3.1, see the comments on the question for resolution

Schu
  • 1,124
  • 3
  • 11
  • 23