We ran into some strange problem: in several keys / cookies, they are deleted / disappear from the session in our rails 3.2 application (intermediate environment), which has the following cache settings. The session store is a cookie store and is configured as follows:
Appsrv::Application.config.session_store :cookie_store, { :key => 'SSID', :path => '/', :domain => APP_CONFIG['site_url'].sub(/^https?:\/\//, ""), :expire_after => 30.minutes, :secret => 's23asdfe443534afdgstreggv234324we434', :secure => false
The cache storage is memcache storage, and we use dalli gem to integrate rails and memcache.
The following configuration has been added to different .rb files:
config.cache_store = :dalli_store, 'staging01:11211', 'staging02:11211', 'staging03:11211', 'staging04:11211' {:namespace => "appsrv", :expires_in => 86400, :compression => true} config.action_controller.perform_caching = true
The flow where this cookie-free scenario occurs is a bit more complicated. The scenario where this happens is as follows:
- The user starts the session by visiting the page in the Appsrv application (rails 3.2 application, some variables that define the user's transaction are set in the session at this time).
- Go to an external website for authorization.
- The external website is redirected to the Java application server upon successful completion.
- The Java application server writes auth and redirects back to Appsrv.
- But after this redirection, the session variables set in step 1 disappeared.
Some strange finds: Everything works fine in a development environment, where the only difference is:
config.action_controller.perform_caching = false
If we have the same setting in the "config.action_controller.perform_caching = false" mode, then the setting also works fine. Even if "config.action_controller.perform_caching" is set to false, caching actually happens correctly in controllers and models.
So the questions are: 1. Why are session cookies deleted when config.action_controller.perform_caching is set to true? 2. What is the configuration value config.action_controller.perform_caching, if set to false, also allows the cache to function normally?