Forum: Ruby on Rails Session problem mongrel behind Apache proxy

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F215bf3ca5bda3a504003bd0181b6a5f?d=identicon&s=25 Nicolas St-laurent (nist)
on 2007-04-19 15:17
(Received via mailing list)

I've configured mongrel_clusters behind an Apache 2.2 proxy using
named virtual host. Session are saved as ActiveRecordSession. But the
cookies created on client side doesn't correspond to session data
saved in database (keys are different). The RoR app react just like it
doesn't have a session at all.

If I don't use Apache as a proxy/load balancer and call directly
Mongrel_cluster, everything works well.

What should I do to get session working with Mongrel behind an Apache
proxy/load balancer ?

**** Extract of my Apache config *****

# Setup a cluster for each application
<Proxy balancer://myapp>

    ServerName myapp.xxxxxxxx.yyy
    DocumentRoot /srv/www/rails/myapp/public

    <Directory "/srv/www/rails/myapp/public">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all

    # The root of this virtual host redirect to Portal application
    ProxyPass / balancer://myapp/
    ProxyPassReverse / balancer://myapp/
    ProxyPreserveHost on

    # Make all of the /public/images directory served by Apache
    ProxyPass /images !
    Alias /images /srv/www/rails/myapp/public/images

    # Setup your Rewrite rules here
    RewriteEngine On

    # Rewrite index to check for static
    RewriteRule ^/$ /index.html [QSA]

    # Send all requests that are not found as existing files to the
    RewriteRule ^/(.*)$ balancer://myapp%{REQUEST_URI} [P,QSA,L]

    # Error logs
    ErrorLog /var/log/apache2/myapp_error_log
    CustomLog /var/log/apache2/myapp_access_log combined

**** END ****


This topic is locked and can not be replied to.