Specifying session_id in params?

I am using a Flex based front end on top of a rails backend. When the
SWF is first loaded from the rails app to the client’s browser, a
session is created on the rails side.

However, subsequent requests from the loaded Flex app are also creating
whole new sessions as well. I need the flex app’s calls to continue
using the existing session.

So I am sending the flexapp the original session id, and am then
appending that session id into the params when it sends it back. Is
there anything else you need to do besides inserting the specific
session id into the request params to get rails to use that session id
instead of making a new one? If it makes a difference, this is a
multipart post from the flex app back to the rails server.

Here is an example sequence of events – the first request is what
serves the SWF to the client’s browser:

Processing MainController#index (for 127.0.0.1 at 2009-02-09 15:31:44)
[GET]
Session ID: ff99a1a31c21bcd247390e8c54b65dc9

Next, I am doing a callback from within the flex SWF as a multipart post
request, with the “_session_id” parameter specified:

Processing ApiController#upload (for 127.0.0.1 at 2009-02-09 15:32:05)
[POST]
Session ID: c104c28b75d712f3dd81f59dd39d963d
Parameters: {“Filename”=>“att2.jpg”,
“_session_id”=>“ff99a1a31c21bcd247390e8c54b65dc9”, “action”=>“upload”,
“Upload”=>“Submit Query”, “controller”=>“api”, “fb_sig_user”=>“null”,
“Filedata”=>#<File:/var/folders/h2/h228JZQKHUmVvaxHLCmPh++++TM/-Tmp-/CGI.350.3>}

As you can see, the “_session_id” parameter in the 2nd request matches
the first requests Session ID. However, the 2nd request clearly is
getting a different session.

Any ideas?

On 9 Feb 2009, at 20:42, Brian Culler wrote:

So I am sending the flexapp the original session id, and am then
appending that session id into the params when it sends it back. Is
there anything else you need to do besides inserting the specific
session id into the request params to get rails to use that session id
instead of making a new one? If it makes a difference, this is a
multipart post from the flex app back to the rails server.

Reading the session_id from the params is turned off by default. Try
setting the cookie_only option to false (and make sure that the
session_key option matches whatever flex is sending)

Fred