Just out of curiosity, have you tried proxying your requests from Apache to Mongrel without using the Proxy Balancer? In other words, taking the balancer out of the equation by just:<br><br><div style="margin-left: 40px;">
ProxyPass /rails <a href="http://localhost:3000/">http://localhost:3000/</a><br></div><br>Granted I'm not using SSL, but I am in the process of setting up Apache/mod_proxy/Mongrel and everything works great if I just do a direct ProxyPass. When I try to use the balancer things go haywire...
<br><br>I don't have any answers, I just read your post and noticed that you were using the balancer and having problems. Removing the balancer from the setup might be an interesting troubleshooting exercise...<br><br>Jeremy
<br><br><div><span class="gmail_quote">On 5/10/06, <b class="gmail_sendername">Paul Wright</b> <<a href="mailto:wrighty@gmail.com">wrighty@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 10/05/06, Zed Shaw <<a href="mailto:zedshaw@zedshaw.com">zedshaw@zedshaw.com</a>> wrote:<br>> On Mon, 2006-05-08 at 15:58 +0100, Paul Wright wrote:<br>> > Hi all,<br>> ><br>> <snip><br>>
<br>> > I've seen in a few places [1][2] that the trailing slash is important<br>> > on the ProxyPass directive but if I include that then I get a BAD<br>> > CLIENT error in mongrel due to too many slashes:
<br>> ><br>> This is really weird that you have to add the //. That type of URL is<br>> rejected because it violates the actual URI grammar (from what I<br>> understand of it). If balancer needs this, then I'm curious why it's
<br>> bleeding that // to the backend.<br>><br>> I'll check it out to find out why this is the accepted wisdom.<br><br>I personally don't have to add the trailing slash to the setup and,<br>after going back over the places I saw it mentioned only one of them
<br>claimed it needed to be there. The other was warning against it. So<br>just discard the above. I think.<br><br>> > The two main problems I have now is that all rendered links are<br>> > missing the sub-directory and if any redirects are issued then they
<br>> > are for <a href="http://admin.example.com:12345/">http://admin.example.com:12345/</a> instead of the ssl version<br>> > <a href="https://admin.example.com:12345/">https://admin.example.com:12345/</a> - is this because mongrel/rails is
<br>> > only seeing a http request? And if so is it possible to let the app<br>> > know that it's actually https and in a subdirectory?<br>><br>> I'll have to look at this. It might be that mongrel will have to detect
<br>> that the request was secured and add the https, but I really think Rails<br>> should do this since this is where the redirect is generated.<br>><br>> Take a look at the headers that Mongrel receives and see if you are
<br>> getting the header that indicates the request was secured. If you are<br>> then Rails must not be honoring it. If not then you need to tell your<br>> web server to start sending it.<br><br>Having run mongrel in debug mode I've looked at the headers and
<br>there's nothing there to suggest that Apache has proxied a https<br>connection. Looking through the Rails source[1] I see that there are<br>two situations where Rails will generate https links<br><br>153 def ssl?
<br>154 @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'<br>155 end<br><br>I had thought that I could used the [E=VAR:VAL] flag on a Rewrite rule<br>but then I remembered that we're proxying to an independant http
<br>server (mongrel) so it wouldn't make it across. I've got it working<br>by adding RequestHeader directive to my Rewrite rules:<br><br>RewriteEngine On<br># Punt any pontential 404s to the proxy<br>RewriteCond %{REQUEST_FILENAME} ^/rails/.*
<br>RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f<br>RequestHeader set X_FORWARDED_PROTO 'https'<br>RewriteRule ^/rails/(.*)$ balancer://proxy_group/$1 [proxy]<br><br>(I don't know apache well enough to know whether the RequestHeader
<br>will fire only apply when the RewriteCond or for every request to this<br>VirtualHost but I'm confident it won't hurt non-rails requests.)<br><br>All that's left now is working out how to set the environment variable<br>
RAILS_RELATIVE_URL_ROOT... Any clues?<br><br>Paul.<br><br>[1] - <a href="http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/request.rb">http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/request.rb
</a><br><br>_______________________________________________<br>Mongrel-users mailing list<br><a href="mailto:Mongrel-users@rubyforge.org">Mongrel-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/mongrel-users">
http://rubyforge.org/mailman/listinfo/mongrel-users</a><br></blockquote></div><br>