Sinatra permits: sessions not working on passenger / apache

I had problems with inclusion: sessions are saved for a simple Sinatra application hosted on passenger / apache. I save the session state [: authorized] in a cookie. It works locally when hosted in Rack :: Handler :: Mongrel, but I can't seem to get the same behavior on the passenger.

I tried two methods to enable sessions, both of which do not work on the passenger / apache enable setting: sessions

and

use Rack :: Session :: Pool ,: domain => 'example.com' ,: expire_after => 60 * 60 * 24 * 365

Any ideas on how to fix it?

+4
source share
2 answers

We came across something similar, although we did not use Apache / Passenger (in development mode). We solved it like this:

Comment on the Rack :: Session commands from your Sinatra app. Do this in the config.ru file. and haven only enable: sessions in your sinatra application.

That should work.

+1
source

This problem arose for me because I enabled sessions in the wrong configuration area. My configuration looked like this:

configure :development do # ... other settings ... enable :sessions end 

By moving enable :sessions from :development , certain configuration sessions started working for me:

 configure :development do # ... other settings ... end enable :sessions 
+1
source

All Articles