Created
March 22, 2012 02:30
-
-
Save kevinelliott/2155230 to your computer and use it in GitHub Desktop.
Override session lookup for ActiveRecord::SessionStore::Session to find by session id in request header X_Session_ID, and fallback to default lookup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActionDispatch | |
| module Session | |
| class AbstractStore | |
| # Override the default way to extract the session id | |
| # First check for a X_Session_ID request header, otherwise fallback to cookies/params | |
| def extract_session_id(env) | |
| request = Rack::Request.new(env) | |
| sid = request.env['HTTP_X_SESSION_ID'] | |
| sid ||= request.cookies[@key] | |
| sid ||= request.params[@key] unless @cookie_only | |
| sid | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment