Hi,
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>
BalancerMember http://10.1.4.22:3000
BalancerMember http://10.1.4.22:3001
BalancerMember http://10.1.4.22:3002
<VirtualHost 10.1.4.22:80>
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
</Directory>
# 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
cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
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 ****
Thanks,
Nist