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 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> 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 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