Bluehost.com Web Hosting $6.95

HTTP Apache, RewriteRule [L,P] to localhost

This is a discussion on HTTP Apache, RewriteRule [L,P] to localhost within the Windows Web Servers forums, part of the Web Server and Related Forums category; Hello, I have trouble with Apache behaviour between two environments with equivalent configuration files. I have a rewrite rule with [...


Go Back   Usenet Forums > Web Server and Related Forums > Windows Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-31-2007
Seb
 
Posts: n/a
Default HTTP Apache, RewriteRule [L,P] to localhost

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 01:04 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0