httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thias <Mark.Th...@bnpi.com>
Subject [users@httpd] ProxyPassReverse, mod_rewrite, load balancing issue
Date Wed, 24 Dec 2003 16:19:11 GMT

I have configured Apache to use mod_rewrite to round robin between two
JBoss/Jetty App. Servers. I added the ProxyPassReverse to httpd.conf so the
URL displayed in the browser would not show the re-routed address (i.e.
ServerOne:8080) . However, as the JSP page is being rendered, Apache
alternates between the two app. servers to retrieve parts of the page. For
example to load login.jsp:

1. Goes to server1 to load login.jsp
2. Goes to server2 to load system.css which is a style sheet included by
login.jsp
3. Goes to server1 to load form_util.js which is some java script included
by login.jsp
4. Goes to server2 to load login.css which is a style sheet included by
login.jsp
etc...

This alternating process continues until the page is loaded. I've included
the logs which show the process with and without the ProxyPassReverse. My
hope is that once a user is routed to a particular app. server and logs on,
all of their processing will go through that app. server. It seems to work
this way if I do not include the ProxyPassReverse.

My environment is as follows: 
 1. Apache 2.0.48 
 2. Win2K 5.00.2195 Service Pack 3 
 3. Python23

httpd.conf:
<VirtualHost _default_:80>
RewriteEngine on
RewriteLogLevel 20
RewriteLog rewrite.log
RewriteMap servers "prg:C:/Tools/Python23/python.exe -u c:/proxy.py"
RewriteRule ^(http|https)://.* - [F]
RewriteRule ^/(.*)$ to://${servers:}/$1
RewriteRule ^to://([^/]+)/(.*) http://$1/$2   [P,L]
RewriteRule .* - [F]

#ProxyPassReverse / http://ServerOne:8080/
#ProxyPassReverse / http://ServerTwo:8080/
</VirtualHost> 


Mod Rewrite Log with ProxyPassReverse:
(2) init rewrite engine with requested uri /ctms/
(3) applying pattern '^(http|https)://.*' to uri '/ctms/'
(3) applying pattern '^/(.*)$' to uri '/ctms/'
(5) map lookup OK: map=servers key= -> val=ServerOne:8080
(2) rewrite /ctms/ -> to://ServerOne:8080/ctms/
(3) applying pattern '^to://([^/]+)/(.*)' to uri 'to://ServerOne:8080/ctms/'
(2) rewrite to://ServerOne:8080/ctms/ -> http://ServerOne:8080/ctms/
(2) forcing proxy-throughput with http://ServerOne:8080/ctms/
(1) go-ahead with proxy request proxy:http://ServerOne:8080/ctms/ [OK]
(2) init rewrite engine with requested uri /ctms/apps/login/login.jsp
(3) applying pattern '^(http|https)://.*' to uri
'/ctms/apps/login/login.jsp'
(3) applying pattern '^/(.*)$' to uri '/ctms/apps/login/login.jsp'
(5) map lookup OK: map=servers key= -> val=ServerTwo:8080
(2) rewrite /ctms/apps/login/login.jsp ->
to://ServerTwo:8080/ctms/apps/login/login.jsp
(3) applying pattern '^to://([^/]+)/(.*)' to uri
'to://ServerTwo:8080/ctms/apps/login/login.jsp'
(2) rewrite to://ServerTwo:8080/ctms/apps/login/login.jsp ->
http://ServerTwo:8080/ctms/apps/login/login.jsp
(2) forcing proxy-throughput with
http://ServerTwo:8080/ctms/apps/login/login.jsp
(1) go-ahead with proxy request
proxy:http://ServerTwo:8080/ctms/apps/login/login.jsp [OK]
(2) init rewrite engine with requested uri /ctms/apps/styles/system.css
(3) applying pattern '^(http|https)://.*' to uri
'/ctms/apps/styles/system.css'
(3) applying pattern '^/(.*)$' to uri '/ctms/apps/styles/system.css'
(5) map lookup OK: map=servers key= -> val=ServerOne:8080
(2) rewrite /ctms/apps/styles/system.css ->
to://ServerOne:8080/ctms/apps/styles/system.css
(3) applying pattern '^to://([^/]+)/(.*)' to uri
'to://ServerOne:8080/ctms/apps/styles/system.css'
(2) rewrite to://ServerOne:8080/ctms/apps/styles/system.css ->
http://ServerOne:8080/ctms/apps/styles/system.css
(2) forcing proxy-throughput with
http://ServerOne:8080/ctms/apps/styles/system.css
(1) go-ahead with proxy request
proxy:http://ServerOne:8080/ctms/apps/styles/system.css [OK]
(2) init rewrite engine with requested uri /ctms/apps/scripts/form_utils.js
(3) applying pattern '^(http|https)://.*' to uri
'/ctms/apps/scripts/form_utils.js'
(3) applying pattern '^/(.*)$' to uri '/ctms/apps/scripts/form_utils.js'
(5) map lookup OK: map=servers key= -> val=ServerTwo:8080
(2) rewrite /ctms/apps/scripts/form_utils.js ->
to://ServerTwo:8080/ctms/apps/scripts/form_utils.js
(3) applying pattern '^to://([^/]+)/(.*)' to uri
'to://ServerTwo:8080/ctms/apps/scripts/form_utils.js'
(2) rewrite to://ServerTwo:8080/ctms/apps/scripts/form_utils.js ->
http://ServerTwo:8080/ctms/apps/scripts/form_utils.js
(2) forcing proxy-throughput with
http://ServerTwo:8080/ctms/apps/scripts/form_utils.js
(1) go-ahead with proxy request
proxy:http://ServerTwo:8080/ctms/apps/scripts/form_utils.js [OK]
(2) init rewrite engine with requested uri /ctms/apps/styles/login.css
(3) applying pattern '^(http|https)://.*' to uri
'/ctms/apps/styles/login.css'
(3) applying pattern '^/(.*)$' to uri '/ctms/apps/styles/login.css'
(5) map lookup OK: map=servers key= -> val=ServerOne:8080
(2) rewrite /ctms/apps/styles/login.css ->
to://ServerOne:8080/ctms/apps/styles/login.css
(3) applying pattern '^to://([^/]+)/(.*)' to uri
'to://ServerOne:8080/ctms/apps/styles/login.css'
(2) rewrite to://ServerOne:8080/ctms/apps/styles/login.css ->
http://ServerOne:8080/ctms/apps/styles/login.css
(2) forcing proxy-throughput with
http://ServerOne:8080/ctms/apps/styles/login.css
(1) go-ahead with proxy request
proxy:http://ServerOne:8080/ctms/apps/styles/login.css [OK]
(2) init rewrite engine with requested uri
/ctms/apps/scripts/system_utils.js
(3) applying pattern '^(http|https)://.*' to uri
'/ctms/apps/scripts/system_utils.js'
(3) applying pattern '^/(.*)$' to uri '/ctms/apps/scripts/system_utils.js'
(5) map lookup OK: map=servers key= -> val=ServerTwo:8080
(2) rewrite /ctms/apps/scripts/system_utils.js ->
to://ServerTwo:8080/ctms/apps/scripts/system_utils.js
(3) applying pattern '^to://([^/]+)/(.*)' to uri
'to://ServerTwo:8080/ctms/apps/scripts/system_utils.js'
(2) rewrite to://ServerTwo:8080/ctms/apps/scripts/system_utils.js ->
http://ServerTwo:8080/ctms/apps/scripts/system_utils.js
(2) forcing proxy-throughput with
http://ServerTwo:8080/ctms/apps/scripts/system_utils.js
(1) go-ahead with proxy request
proxy:http://ServerTwo:8080/ctms/apps/scripts/system_utils.js [OK]
(2) init rewrite engine with requested uri
/ctms/apps/media/images/bnpi-logo-long.jpg
(3) applying pattern '^(http|https)://.*' to uri
'/ctms/apps/media/images/bnpi-logo-long.jpg'
(3) applying pattern '^/(.*)$' to uri
'/ctms/apps/media/images/bnpi-logo-long.jpg'
(5) map lookup OK: map=servers key= -> val=ServerOne:8080
(2) rewrite /ctms/apps/media/images/bnpi-logo-long.jpg ->
to://ServerOne:8080/ctms/apps/media/images/bnpi-logo-long.jpg
(3) applying pattern '^to://([^/]+)/(.*)' to uri
'to://ServerOne:8080/ctms/apps/media/images/bnpi-logo-long.jpg'
(2) rewrite to://ServerOne:8080/ctms/apps/media/images/bnpi-logo-long.jpg ->
http://ServerOne:8080/ctms/apps/media/images/bnpi-logo-long.jpg
(2) forcing proxy-throughput with
http://ServerOne:8080/ctms/apps/media/images/bnpi-logo-long.jpg
(1) go-ahead with proxy request
proxy:http://ServerOne:8080/ctms/apps/media/images/bnpi-logo-long.jpg [OK]


Mod Rewrite Log without ProxyPassReverse:
(2) init rewrite engine with requested uri /ctms/
(3) applying pattern '^(http|https)://.*' to uri '/ctms/'
(3) applying pattern '^/(.*)$' to uri '/ctms/'
(5) map lookup OK: map=servers key= -> val=ServerOne:8080
(2) rewrite /ctms/ -> to://ServerOne:8080/ctms/
(3) applying pattern '^to://([^/]+)/(.*)' to uri 'to://ServerOne:8080/ctms/'
(2) rewrite to://ServerOne:8080/ctms/ -> http://ServerOne:8080/ctms/
(2) forcing proxy-throughput with http://ServerOne:8080/ctms/
(1) go-ahead with proxy request proxy:http://ServerOne:8080/ctms/ [OK]


Thank you,
  Mark Thias
  


This email may contain confidential and privileged material for the sole use
of the intended recipient. Any review or distribution by others is strictly
prohibited.  If you are not the intended recipient please contact the sender
and delete all copies.

Mime
View raw message