Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #714

Quick sanity check on apache rewrite/reverseproxy rules

From Tim Watts <tw@dionic.net>
Newsgroups comp.os.linux.misc
Subject Quick sanity check on apache rewrite/reverseproxy rules
Followup-To comp.os.linux.misc
Date 2011-04-14 08:03 +0100
Organization A noiseless patient Spider
Message-ID <6qii78-0ht.ln1@squidward.dionic.net> (permalink)

Followups directed to: comp.os.linux.misc

Show all headers | View raw


Hi,

This seems to work - wondered if anyone could comment on it's sanity:

RewriteEngine on
RewriteRule                 "^/wibble/(.*)$" "/$1"
RewriteRule                 "^(/_a/.*)$"    "$1"                       [PT]
RewriteRule                 "^/(.*)$"  "http://localhost:8180/wibble/$1" [P]
ProxyPassReverse            /          http://localhost:8180/wibble/
ProxyPassReverseCookiePath /wibble      /

This is to do with fronting a tomcat webapp /wibble on port 8180 with 
apache.

The logic is:

* Knock any /wibble prefix off the URL ('cos the tomcat is rooted there)
* (reverse) Proxy everything to localhost:8180/wibble/$1 EXCEPT
* anything beginning _a should be handled by regular filemap by apache 
(static content)

* Fix any redirects etc coming from the server towards the client.

I tried a ProxyPass - but it seems to take precendence over the rewrites. I 
added a Proxy ... ! directive, but it all got rather messy mixing them.

I guess, the real question is:

Is "ProxyPass blah BLAH" identical to
RewriteRule ^blah/(.*)$ /BLAH/$1 [P]

or are there some subtle differences I might get caught by?

RTFM, seems to be the case (rewrite ...[P] uses mod_proxy) but just checking 
as I will be using the recipe on many servers in due course.

TIA :)

Tim
-- 
Tim Watts

Back to comp.os.linux.misc | Previous | Next | Find similar


Thread

Quick sanity check on apache rewrite/reverseproxy rules Tim Watts <tw@dionic.net> - 2011-04-14 08:03 +0100

csiph-web