Sonntag, Mai 17, 2009

No Login after upgrade to Rails 2.3?

It cost me some hours on a sunday afternoon. After I upgraded to Rails 2.3.2 the login didnt work anymore. I read the release notes and followed all the instructions for cookie based sessions, like renaming session_key to key in the session config hash but still no luck. Things got more confused because locally everything worked fine. To make it short the solution is really very simple but you dont read much about it: you need to upgrade passenger to the newest version.


gem install passenger

passenger-install-apache2-module


And dont forget to adjust your apache config with the new settings. These are generated by the installer so you can just copy them.

Sonntag, Jänner 11, 2009

switching to passenger

Though I am working with passenger for a while now, I just had new projects which started from the scratch using passenger. This week I switched my first mongrel based rails app to passenger. The idea was using passengers GlobalQueue option to optimize overall perfomance. One of the major mongrel drawbacks is its port based queues. If you have long running requests all others in the queue for that port have to wait. Thats different if you have just one global queue which doesnt pass request to busy processes.

While this works well as expected there are some minor modifications in the request header because the proxy has gone. For instance the webapplication read the calling ip address with the HTTP_X_FORWARDED_FOR header info. This is empty now with passenger.

So instead of calling

request.env['HTTP_X_FORWARDED_FOR']

I had to use

request.env['REMOTE_ADDR']
which has just the same info, the calling IP.