Am having trouble getting enable :sessions to persist for a simple Sinatra app hosted on passenger/apache. I'm storing the state of session[:authorized] in a cookie. It works locally when hosted on Rack::Handler::Mongrel but I can't seem to get same behaviour on passenger.
I've tried two methods for enabling sessions, both of which don't work on the passenger/apache installation
enable :sessions
and
use Rack::Session::Pool, :domain => 'example.com', :expire_after => 60 * 60 * 24 * 365
Any ideas on how to fix?
We were facing something similar although we were not using Apache / Passenger (in development mode). We resolved it like this -
Comment out the Rack::Session commands from within your Sinatra app. Do it in the config.ru file. and haven only enable :sessions in your sinatra app.
That should work.
This issue occurred for me because I had enabled sessions in the wrong configuration area. My configuration looked like this:
configure :development do
# ... other settings ...
enable :sessions
end
By moving enable :sessions
out of the :development
specific configuration sessions started working for me:
configure :development do
# ... other settings ...
end
enable :sessions