HTTP Apache, RewriteRule [L,P] to localhost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have trouble with Apache behaviour between two environments with
equivalent configuration files.
I have a rewrite rule with [L,P] flags and substitution URL target the local
apache server.

When the server is requested in consequence to proxy rewrite rule :
  - In environement 1, there are no more rewriting (proxy request processed
internally after initial rewriting)
  - In environement 2, there are 2nd rewriting pass (it is a new HTTP
request)

Apache version 2.0.52  
  
Extract from httpd.conf from server-one.com :

-------------------------------------------------------------------------------

#
# si on tape / on arrive sur /index.jsp
#
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/ http://server-one.com:7000/index.jsp [L,P]

ProxyPass /index.jsp http://anotherserver.com:7005/Accueil/index.jsp
ProxyPassReverse /index.jsp http://anotherserver.com:7005/Accueil/index.jsp

-------------------------------------------------------------------------------

The httpd.conf of server-two.com is the same, modulo server name references.

Logs  (1 rewriting pass) on server-one.com :

000.00.000.01 - - [27/Jul/2007:13:24:35 +0200]
[server-one.com/sid#b4590][rid#1797d8/initial] (2) init rewrite engine with
requested uri /
000.00.000.01 - - [27/Jul/2007:13:24:35 +0200]
[server-one.com/sid#b4590][rid#1797d8/initial] (3) applying pattern '^/' to
uri '/'
000.00.000.01 - - [27/Jul/2007:13:24:35 +0200]
[server-one.com/sid#b4590][rid#1797d8/initial] (4) RewriteCond: input='/'
pattern='^/$' => matched
000.00.000.01 - - [27/Jul/2007:13:24:35 +0200]
[server-one.com/sid#b4590][rid#1797d8/initial] (2) rewrite / ->
http://server-one.com:80/index.jsp
000.00.000.01 - - [27/Jul/2007:13:24:35 +0200]
[server-one.com/sid#b4590][rid#1797d8/initial] (2) forcing proxy-throughput
with http://server-one.com:80/index.jsp
000.00.000.01 - - [27/Jul/2007:13:24:35 +0200]
[server-one.com/sid#b4590][rid#1797d8/initial] (1) go-ahead with proxy
request proxy:http://server-one.com:80/index.jsp [OK]

Logs  (2 rewriting passes)  on server-two.com  @ IP = 000.00.000.02 :

000.00.000.01 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (2) init rewrite engine with
requested uri /
000.00.000.01 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (3) applying pattern '^/' to
uri '/'
000.00.000.01 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (4) RewriteCond: input='/'
pattern='^/$' => matched
000.00.000.01 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (2) rewrite / ->
http://server-two.com:7000/index.jsp
000.00.000.01 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (2) forcing proxy-throughput
with http://server-two.com:7000/index.jsp
000.00.000.01 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (1) go-ahead with proxy
request proxy:http://server-two.com:7000/index.jsp [OK]
000.00.000.02 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (2) init rewrite engine with
requested uri /index.jsp
000.00.000.02 - - [27/Jul/2007:15:37:28 +0200]
[server-two.com/sid#b5f20][rid#17a928/initial] (3) applying pattern '^/' to
uri '/index.jsp'

I would like obtain server-one.com behaviour on the both server.
Something in context of serveur-two.com modify behaviour... but what ?


To generalize subject :

In httpd.conf de myserver.com :
 
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^/ http://myserver.com/index.jsp [L,P]
 
#<AnotherRewritingRules>
 
ProxyPass /index.jsp http://anotherserver.com/Accueil/index.jsp
ProxyPassReverse /index.jsp http://anotherserver.com/Accueil/index.jsp
 
Scenario :
 
1. User stroke http://myserver.com/ on browser
2. For myserver.com, for mod_rewrite, 1st rewriting rule is executed and
after mod_proxy module is executed with URL http://myserver.com/index.jsp. 
3. For mod_proxy, server act as reverse proxy to itself, but two alternative
behaviours (what is the factor ?...)  :
    a) URL http://myserver.com/index.jsp is just a classic URL and so a new
HTTP request is processed  and so rewrting rules are applied to this new
request
    b) apache  "detect" the reverse proxy to itself and "squiz" rewriting
rules and execute ProxyPass directive to 
http://myserver.com/Accueil/index.jsp

Question : 

What is the factor to switch to a) or b) ?

Thanks.
 
-- 
View this message in context: http://www.nabble.com/HTTP-Apache%2C-RewriteRule--L%2CP--to-localhost-tf4196416.html#a11934875
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux