Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Choosing between mod_proxy and mod_rewrite
If you're connecting an Apache httpd server to an Apache Tomcat server, you can do so via proxied http requests - i.e. have your customer facing http server relay the request on, perhaps having modified it, to Tomcat and then passing the response back. Two different Apache modules give you the facility - mod_proxy and mod_rewrite.

With mod_proxy, You specify the start of the URL and how it is to be replaced in the proxy request, and it forwards on that basis:

ProxyRequests Off
<Proxy *>
        Order deny,allow
        Allow from all
</Proxy>
ProxyPass /jd http://192.168.200.1:8882/latmjdemo
ProxyPassReverse /jd http://192.168.200.1:8882/latmjdemo


With mod_rewrite, you use a regular expression instead, and you must use a [P] modifier to trigger the request to be proxied onward rather that written forward within the same server, for example:

RewriteEngine On
RewriteRule je/(.*) http://192.168.200.1:8882/latmjdemo/$1 [P,L]


Which is best? mod_proxy is simpler, and you can (in Apache http2 2.2) also use mod_proxy_balancer to share the forwarding to different proxy servers. mod_rewrite has more flexibility and can be used if you want to share servers, but forward all visits that form part of the same session to the same server in the pool to provide you with practical load balancing.

We cover this subject briefly on our Deploying Apache httpd and Tomcat course and can cover it in more depth on private courses. (The sample configurations above happen to come from a private course I was giving today!)

See also:
Load balancing with mod_jk
A comparison between http, ajp and https protocols

(written 2007-10-02 21:11:30)

 
Associated topics are indexed under
A655 - Web Application Deployment - Using Tomcat and Apache httpd Together
A900 - Web Application Deployment - Tomcat - Extra Features

Back to
Python v Ruby
Previous and next
or
Horse's mouth home
Forward to
Load Balancing with Apache mod_jk (httpd/Tomcat)

Some other Articles
Static variables in PHP
Simple page password protection - PHP
Etag in http headers - what is it?
Load Balancing with Apache mod_jk (httpd/Tomcat)
Choosing between mod_proxy and mod_rewrite
Python v Ruby
Maidenhead Coffee Challenge
New Month, New Quarter, New Laws
A taster PHP expression ...
Hotel in Melksham at Christmas
1634 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho