Rails 3 is changing session ID on POST from AIR -
i have rest api in rails 3 being accessed air application , browser.
i think rails 3 problem might flex/air problem.
the rails app uses omniauth authentication, cancan authorization, , active_record_store. use session model store identity of user.
(there reason i'm not using cookie sessions, having air android, oauth, , stagewebview.)
i'm using charles monitor http traffic.
most requests work fine. browser (or air client) sends session id server using cookie http header, this:
_session_id=950dee7eca6732aa62b5f91876f66d15
and rails finds session, figures out user is, , thing.
but under circumstances, rails generates new session before sending response. adds session sessions table, , returns set-cookie header client new session id. this:
_session_id=e1489a6b610c0a1d13cec1454228ae47; path=/; httponly
the circumstances under happens are:
- the request comes air client
- the request post
this problem, because on subsequent requests, rails can't find user information. created new session without information.
so i'm looking @ http headers post request. here's copy/paste charles; inserted colon after header name make readable.
host: localhost.seti.hg94.com:3000 content-type: application/x-www-form-urlencoded user-agent: mozilla/5.0 (macintosh; u; intel mac os x; en) applewebkit/531.9 (khtml, gecko) adobeair/2.6 referer: app:/androidapplication.swf x-flash-version: 10,2,152,22 accept: */* accept-language: en-us accept-encoding: gzip, deflate cookie: _session_id=950dee7eca6732aa62b5f91876f66d15 content-length: 84 connection: keep-alive
does anyone have insight why rails generate new session under circumstances? seems happening after controller code executes, since have correct session information in controller.
i'm busy trying isolate problem further, control headers within air, , on. i've been working on bug week. insight or suggestions community appreciated.
only guess, seems you're not bringing across csrf token rails generates post-based requests:
http://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf
Comments
Post a Comment