Rails 2.3.14 setting expire_after for sessions is ignored

Posted by Sergii Shablatovych on Stack Overflow See other posts from Stack Overflow or by Sergii Shablatovych
Published on 2012-05-31T16:04:29Z Indexed on 2012/05/31 22:41 UTC
Read the original article Hit count: 180

I have next config in my environment.rb:

config.action_controller.session_store = :cookie_store
config.action_controller.session = {
:expire_after   => 14.days,
:domain         => DOMAIN,
:session_key    => '_session',
:secret         => 'some_string'
}

Setting session_store to active_record_store or mem_cache_store didn't help. Also i've tried just setting cookie from controller (with all founded options for expire):

cookies[:test] = { :value => 'test' , :expires => 3600.to_i.from_now.utc }

In both ways all sessions and cookies are deleted after closing browser window - they are only for browser session. I've tried almost all variants founded in the Internet - no luck(

My config is: Ubuntu 10.04 LTS, rails 2.3.14, ruby Enterprise Edition 1.8.7, Phusion Passenger version 3.0.11 and Nginx compiled by Phusion Passenger.

I've an options that it's Nginx not allowing setting some headers but also didn't find any solution.

Any help appreciated! Thanks

UPD. i've tried to put all configs for sessions to config/initializers/session_store.rb - nothing changed. i have a feeling that it's not a rails problem. may it be phusion + nginx error? i don't even know how to check where the problem is.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about session