Hi,

On Tue, Dec 15, 2009 at 05:47:49PM -0500, Ken Roe wrote:
> We are trying to make application URLs friendly using rewrite rules.
> The goal is to eliminate the context path of the web application from
> the url.
> 
>  
> 
> Example: 
> 
> The URL http://app.company.com should rewrite to
> http://backend:8080/app. 

This is a very bad idea, and while it may work in the short term,
you will end up with permanent issues such as erroneously built
resource paths (images, JS, CSS, ...), bad paths on cookies, bad
redirection URLs, or the need to explicitly state a full path with
a host name in each Location header with the need to rewrite it at
every stage of your architecture, etc... I regularly see setups
making use of rewrite rules for this same purpose. The only thing
they can say after a few years of permanent degradation and workarounds
involving hundreds of unmaintainable rewrite rules is always the same :
"it's too late now to remove that crap, we have to live with it".

So... better think twice before digging your hole.

> Is there a way to do this using rewrite rules?

This specific one above cannot because you have to take one part
from the Host header and inject it into the request line. But those
which only move components within the same line do work (eg: rewriting
the host or rewriting the URI).

Regards,
Willy


Reply via email to