ripta.pasay at lunarpages.com
2007-Jan-17 07:26 UTC
[Mongrel] mongrel cluster (+ Apache 2.2.4 + proxy balancer) not redirecting correctly
I''m in the process of setting up a mongrel cluster at the moment, and I''m running into a bit of an issue. Even worse is that I''m not sure whether this is a mongrel thing, or an Apache thing. While I''m inclined to think that this might be a balancer thing, I decided there was a higher chance hearing back from mongrel-users than from apache-users, so I''d try this list first. So, I''m using mongrel 0.3.13.4 with cluster 0.2.1 running rails 1.1.6 on ruby 1.8.5, and the following Apache (v2.2.4) configuration for the virtual host (domain and usernames changed): <VirtualHost *:443> ServerName server.domain.com:443 ServerAdmin me at domain.com DocumentRoot /home/desq/deployment/current #RequestHeader set X_FORWARDED_PROTO ''https'' <Directory "/home/user/deployment/current"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <Proxy balancer://mongrel_cluster> BalancerMember http://127.0.0.1:3000 BalancerMember http://127.0.0.1:3001 </Proxy> RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^/$ /index.html [QSA] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] CustomLog logs/desq-access.log common ErrorLog logs/desq-error.log SSLEngine on SSLCertificateFile /home/user/ssl.crt SSLCertificateKeyFile /home/user/ssl.key </VirtualHost> <VirtualHost *:80> ServerName server.domain.com Redirect permanent / https://server.domain.com </VirtualHost> Also, the cluster YML file: --- port: 3000 pid_file: log/mongrel.pid servers: 2 address: 127.0.0.1 cwd: /home/user/deployment/current user: user group: user environment: production Now (almost) everything works perfectly. Sessions are great, requests are passed on, spread between the instances of mongrel. Sadly, HTTP redirects are not correctly passed somewhere. If I were to connect to the mongrel instances on port 3000 or 3001 directly, the HTTP redirects are correctly processed. With the balancer, it''s not. For example, if going to https://server.domain.com:3000/admin/home redirects to https://server.domain.com:3000/users/login (works without balancer), then going to https://server.domain.com/admin/home redirects to https://server.domain.comusers/login (missing the "/" between the host name and the request URI, thus not working with balancer). I would appreciate any comments or suggestions on how to further hunt this issue down. Cheers, -RP
Francois Beausoleil
2007-Jan-17 14:37 UTC
[Mongrel] mongrel cluster (+ Apache 2.2.4 + proxy balancer) not redirecting correctly
Hi ! 2007/1/17, ripta.pasay at lunarpages.com <ripta.pasay at lunarpages.com>:> <VirtualHost *:443> > <Proxy balancer://mongrel_cluster> > BalancerMember http://127.0.0.1:3000 > BalancerMember http://127.0.0.1:3001 > </Proxy>I also have these directives in my Apache config file. Try them on: ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! ProxyPass / balancer://weputuplights/ ProxyPassReverse / balancer://weputuplights/> </VirtualHost>I am inclined to say that your problem is related to ProxyPassReverse. See http://httpd.apache.org/docs/2.2/en/mod/mod_proxy.html#proxypassreverse Hope that helps ! -- Fran?ois Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/
Surendra Singhi
2007-Jan-17 15:08 UTC
[Mongrel] mongrel cluster (+ Apache 2.2.4 + proxy balancer) not redirecting correctly
Hi, On 1/17/07, ripta.pasay at lunarpages.com <ripta.pasay at lunarpages.com> wrote:> > > ServerAdmin me at domain.com > DocumentRoot /home/desq/deployment/current > #RequestHeader set X_FORWARDED_PROTO ''https'' > > <Directory "/home/user/deployment/current"> > Options FollowSymLinks > AllowOverride None > Order allow,deny > Allow from all > </Directory> > > <Proxy balancer://mongrel_cluster> > BalancerMember http://127.0.0.1:3000 > BalancerMember http://127.0.0.1:3001 > </Proxy>RewriteEngine On> > RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f > RewriteCond %{SCRIPT_FILENAME} !maintenance.html > > RewriteRule ^/$ /index.html [QSA] > > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} > [P,QSA,L] > > CustomLog logs/desq-access.log common > ErrorLog logs/desq-error.log > > SSLEngine on > SSLCertificateFile /home/user/ssl.crt > SSLCertificateKeyFile /home/user/ssl.key > </VirtualHost> > > <VirtualHost *:80> > ServerName server.domain.com > Redirect permanent / https://server.domain.com > </VirtualHost>I have heard missing backslashes can cause many problems, try adding it ''/'', i.e., https://server.domain.com/ Also, it will help to add it to the end of directories. DocumentRoot /home/desq/deployment/current/ HTH. -- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070117/7d323ee0/attachment.html