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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
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 Thu, 14 Apr 2011 08:03:02 +0100
Organization A noiseless patient Spider
Lines 40
Message-ID <6qii78-0ht.ln1@squidward.dionic.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
Injection-Info mx01.eternal-september.org; posting-host="6oIlEBqCjOm0MjsSUEk5CA"; logging-data="12653"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195vDE2DDS/B+9ggHXI8P19uteXjdrpATM="
User-Agent KNode/4.4.6
Cancel-Lock sha1:Sd6EIJc5Tz/T7ES9nfRZrlodjAM=
Xref x330-a1.tempe.blueboxinc.net comp.os.linux.misc:714

Followups directed to: comp.os.linux.misc

Show key headers only | 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