Hi, I''m trying to run 2 servers on the same Linux machine: apache at port 80 (for production) as user apache, and webrick at port 3000 (for development) as me. However, both of these uses /tmp as storage path for sessions, so they share the same session file. This creates permission problem (I browse both servers from the same IP) - plus I''m not sure if sharing session between servers is safe or not. Is there a way to control the session path used by each server? Thanks much
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thien Vuong wrote: | I''m trying to run 2 servers on the same Linux machine: | Is there a way to control the session path used by each server? Since both servers are issuing cookies for the same domain/path combo, sessions will work across servers. Storing the files with different file prefixes or in different directories should solve the problem, as you suggest. CGI::Session takes an options hash [1]. Default options are in railties/lib/dispatcher.rb -- see DEFAULT_SESSION_OPTIONS. You may modify your own public/dispatch.* to configure session options per dispatch method. For example, in public/dispatch.cgi: ~ Dispatcher::DEFAULT_SESSION_OPTIONS.update(''prefix'' => ''rails_cgi_sess.'') And in public/dispatch.servlet: ~ Dispatcher::DEFAULT_SESSION_OPTIONS.update(''prefix'' => ''rails_webrick_sess.'') You may also pass session options as the second argument to Dispatcher.dispatch if you don''t want to muck with the defaults. Best, jeremy [1] http://www.ruby-doc.org/stdlib/libdoc/cgi/rdoc/classes/CGI/Session.html -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBmRnTAQHALep9HFYRAujwAJ9vrOlnBgPa+hoI7+CWaSbGDpxlmwCgu6F2 rwX1Xf0i/SbgxaO+ZTlpU70=ELrE -----END PGP SIGNATURE-----
On Mon, 15 Nov 2004 13:04:19 -0800, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> > CGI::Session takes an options hash [1]. Default options are in > railties/lib/dispatcher.rb -- see DEFAULT_SESSION_OPTIONS. You may > modify your own public/dispatch.* to configure session options per > dispatch method. > > For example, in public/dispatch.cgi: > ~ Dispatcher::DEFAULT_SESSION_OPTIONS.update(''prefix'' => > ''rails_cgi_sess.'') > > And in public/dispatch.servlet: > ~ Dispatcher::DEFAULT_SESSION_OPTIONS.update(''prefix'' => > ''rails_webrick_sess.'') >Great. Thank you very much. Somehow I thought the constant DEFAULT_SESSION_OPTIONS could not be modified. Thien -- Using Opera''s revolutionary e-mail client: http://www.opera.com/m2/