httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pdt_p <pin...@gmail.com>
Subject Re: [users@httpd] Apache mod_rewrite/mod_proxy conflict?
Date Wed, 12 Dec 2007 04:00:49 GMT

Hi.. 

I forgot to mention, the reason why I asked about this dynamic URL because I
have more than 1 internal server and the ip address/hostname for each
internal server that I have to connect to is returned from url parameter.
for example: 
  -  http://<myReveseProxyHostName>/testing/myserverB/otherPath -->
http://myserverB/otherPath
   - http://<myReveseProxyHostName>/testing/192.168.0.88/otherPath -->
http://192.168.0.88/otherPath


pdt_p wrote:
> 
> Hi...
> 
> from this solution:
> RewriteRule ^/testing/(.*)$ http://myserverB/$1 [P,L]
> RewriteRule ^/(.*)$ http://myserverA/$1 [P]
> ProxyPassReverse /testing http://myserverB/
> 
> the original server url is fixed. In this case  http://myserverB and
> http://myserverA. What if the original URL is dynamic which is passed from
> parameter?
> for example: 
>    http://<myReveseProxyHostName>/testing/myserverB/otherPath -->
> http://myserverB/otherPath
> 
> I think for RewriteRule is quite straight forward: RewriteRule
> ^/testing/(.*)$ http://$1 [P]
> but how about the ProxyPassReverse?
> 
> Thank you very much.
> 
> ----
> P
> 
> 
> 
> Neil A. Hillard-2 wrote:
>> 
>> Tamer Embaby wrote:
>>> I have the following simple setup:
>>> 
>>> [1] LoadModule rewrite_module modules/mod_rewrite.so
>>> [2] LoadModule proxy_module modules/mod_proxy.so
>>> [3] LoadModule proxy_http_module modules/mod_proxy_http.so
>>> [4] RewriteEngine on
>>> [5] ProxyPass /testing http://myserverB/
>>> [6] ProxyPassReverse /testing http://myserverB/
>>> [7] RewriteRule ^/(.*)$ http://myserverA/$1 [P]
>>> 
>>> My problem is:
>>> 
>>> When I access http://myserver/testing/index.html, it gets handled by the
>>> rewrite rule and not the proxy module.
>>> 
>>> The interesting point if I changed the order of LoadModule directives
>>> so now it reads:
>>> [1] LoadModule proxy_module modules/mod_proxy.so
>>> [2] LoadModule proxy_http_module modules/mod_proxy_http.so
>>> [3] LoadModule rewrite_module modules/mod_rewrite.so
>>> 
>>> The proxy module handles the request and not the rewrite module!
>>> 
>>> Is this behavior documented somewhere? Where can I read about it? I
>>> tried to Google a lot with no good. How can I control it?
>>> 
>>> Moreover, what if I compiled in the rewrite_mod and proxy_mod statically
>>> into Apache, how would I control the order of modules calling then?
>>> 
>>> I did my home work, scanned the FAQ, Googled but I cannot come up with
>>> any technical explanation for this.
>> 
>> Simple answer - don't mix them in this way (that's what I've been doing,
>> anyway)!  Stick to mod_rewrite and you should be fine:
>> 
>> RewriteRule ^/testing/(.*)$ http://myserverB/$1 [P,L]
>> RewriteRule ^/(.*)$ http://myserverA/$1 [P]
>> ProxyPassReverse /testing http://myserverB/
>> 
>> You can include:
>> 
>> RewriteRule      ^/testing$ /testing/ [R,L]
>> 
>> before the above if you want to handle a missing trailing slash.
>> 
>> HTH,
>> 
>> 
>> 				Neil.
>> 
>> -- 
>> Neil Hillard                    neil.hillard@agustawestland.com
>> AgustaWestland                  http://www.whl.co.uk/
>> 
>> Disclaimer: This message does not necessarily reflect the
>>             views of Westland Helicopters Ltd.
>> 
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Apache-mod_rewrite-mod_proxy-conflict--tp14251664p14288643.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message