httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tamer Embaby <Tamer.Emb...@itworx.com>
Subject [users@httpd] Proxying woes.
Date Tue, 18 Mar 2008 18:59:40 GMT
Hello,

According to http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html:
^/somepath(.*) /otherpath$1 [P]: doesn't make sense, not supported

I have a client who has:
ServerName example.com
RewriteCond %{REQUEST_URI} !^/SomePath/
[1] RewriteRule ^/(.*)$ /SomePath/$1 [L,P]

[2] ProxyPass /SomePath http://otherhost:7070/SomePath
[3] ProxyPassReverse /SomePath http://otherhost:7070/SomePath

On Apache 2.0.63.  Apache is happily doing the following in response to
rewrite rule at [1]:

init rewrite engine with requested uri /
RewriteCond: input='/' pattern='!^/SomePath/' => matched
rewrite / -> /SomePath/
forcing proxy-throughput with http://example.com/SomePath/
go-ahead with proxy request proxy:http://example.com/SomePath/ [OK]

Regardless of that [L,P] doesn't make any sense (among other things above), but actually I
see Apache supports it, and prefixed /SomePath/
[P] with its canonical name and issued a request to "itself" again with
the new path. So first question: is this is OK and supported?

Another thing I noticed is when Apache sent the request
http://example.com/SomePath/ to itself via proxying, it didn't start the
rewrite cycle again; instead it jumped to ProxyPass at [2] directly
and served the page as expected!  Please find the logs below:

proxy_http.c(67): proxy: HTTP: canonicalising URL //example.com/SomePath/
mod_proxy.c(454): Trying to run scheme_handler
proxy_http.c(1723): proxy: HTTP: serving URL http://example.com/SomePath/
proxy_http.c(186): proxy: HTTP connecting http://example.com/SomePath/ to example.com:80
proxy_util.c(1097): proxy: HTTP: fam 2 socket created to connect to example.com
proxy_http.c(336): proxy: socket is connected
proxy_http.c(370): proxy: connection complete to X.X.X.X:80 (example.com)
proxy_http.c(67): proxy: HTTP: canonicalising URL //otherhost:7070/SomePath/
mod_proxy.c(454): Trying to run scheme_handler
proxy_http.c(1723): proxy: HTTP: serving URL http://otherhost:7070/SomePath/
proxy_http.c(186): proxy: HTTP connecting http://otherhost:7070/SomePath/ to otherhost:7070
proxy_util.c(1097): proxy: HTTP: fam 2 socket created to connect to otherhost
proxy_http.c(336): proxy: socket is connected
proxy_http.c(370): proxy: connection complete to X.X.X.X:7010 (otherhost)
proxy_http.c(1557): proxy: start body send
mod_headers.c(527): headers: ap_headers_output_filter()
proxy_http.c(1557): proxy: start body send
mod_headers.c(527): headers: ap_headers_output_filter()
proxy_http.c(1617): proxy: end body send
proxy_http.c(1617): proxy: end body send

Shouldn't start the internal rewrite cycle again when it send the
requests http://example.com/SomePath?

The above mean that for serving / Apache had to issue 2 internal
requests, am I right?

I'm a little bit confused because the configuration is spaghetti and I
need to find some logic that proves it's not the best way to do things
to make my customer change it in a better way.

I didn't search the Inet nor list archive because I cannot figure out
what to search for to get answers to my questions.

We are running Apache 2.0.63 on Solaris 10.

Thanks in advance.

Tamer


---------------------------------------------------------------------
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