I’m experiencing a problem when using pound with Rails. My set up is I
have a machine acting as a load balancer running Pound. This listens
on port 80 and directs requests with a particular URL to two backend
servers both of which are serving my rails app using mongrel cluster
on ports 9000,9001 and 9002. There is a problem with sessions even
though I am storing the session data in my database. If I am logged in
to my application and then on the next request pound send this to a
different backend server to the one I logged in on then another
session gets created and hence I am now logged out. I can see both my
cookie session_id change and a new session get created in the
database.
I can solve this using stick sessions in pound such that the rails
cooke is written as my_app_session_id and pound looks for this cookie
and redirects all request with the same id for this cookie to the same
backend server. However this shouldn’t be necessary. Does anybody have
any ideas.
database.
I can solve this using stick sessions in pound such that the rails
cooke is written as my_app_session_id and pound looks for this cookie
and redirects all request with the same id for this cookie to the same
backend server. However this shouldn’t be necessary. Does anybody have
any ideas.
I have no problems using Pound and sessions. My settings:
Use activerecord store for your sessions
Comment out the _session_id key (or whatever it is) that is created
with your new rails application (my cookie is linked to a domain
anyway, both locally and in production)
The pound config looks like this:
Service
HeadRequire “Host: .mydomain.com.”
BackEnd
Address 127.0.0.1
Port 3000
End
BackEnd
Address 127.0.0.1
Port 3001
End
Thanks for the reply. How do I link cookies to a domain. this may
solve the problems since all requests are going into the same domain
and then get redirected to different physical backend by Pound.
On 16 Aug 2007, at 18:06, Anthony Underwood wrote:
Thanks for the reply. How do I link cookies to a domain. this may
solve the problems since all requests are going into the same
domain and then get redirected to different physical backend by Pound.
It happens automatically
A user will navigate to yourdomain.com and login (or whatever is
needed to create a session). At that moment, a cookie with
_session_id as the key and a hash as a value will be created in your
browser and passed on with each subsequent request. On my MacBook
Pro, I have a local nameserver that allows me to enter urls like
“peter.dev.rails” which get redirected to localhost, so I don’t need
a unique session id identifier for my different rails apps. Using a
local nameserver also allows me to use the subdomain part as an
identifier (handled through account_location) for example.
Best regards
Peter De Berdt
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.