[Update at the bottom] The problem is that after each reload of the page, regardless of what I put in the session, session gets 'reset'.
For example:
session[:test]="test"
puts session.inspect.to_s -> {"test"=>"test"}
(page reload)
puts session.inspect.to_s -> {"csrf"=>"b400efd6.....2362bd", "tracking"=>{"HTTP_USER_AGENT"=>"12a007....b", "HTTP_ACCEPT_LANGUAGE"=>"...."}}
In my nginx configuration I have:
proxy_pass http://localhost:9292;
In main.rb file I have:
configure do
(...)
set :sessions, key: '1234567',
path: '/',
expire_after: 86400,
secret: '7654321'
(...)
end
[Update] It turns out that the response does not contain - set-cookie with the session id. Currently I am using CF->NGINX->Thin/Sinatra. Everything works fine without nginx.