HTTP Apache, RewriteRule [L,P] to localhost
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Web Servers General Talk > HTTP Apache, RewriteRule [L,P] to localhost




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    HTTP Apache, RewriteRule [L,P] to localhost  
Seb


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-01-07 12:23 AM

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 engi
ne
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 pro
xy
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 engi
ne
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 pro
xy
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 engi
ne
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.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:18 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register