Search code examples
rubysessionnginxthin

ambiguous behavior of session variables nginx/ruby/thin server setup


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??


Solution

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