Re: Friendly URLs?
Dnia 2009-12-17, czw o godzinie 07:52 +0100, Willy Tarreau pisze: > On Wed, Dec 16, 2009 at 01:56:06PM +0100, XANi wrote: > > > > > 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). > > > > Its possible to do redirect instead of rewrite ? > > so > > http://profilename.page.com gets redirected to > > http://page/profile/profilename ? > > If you need to automatically extract "profilename" from the request > to build your redirect, then no, it's not possible. But at Exceliance, > we're working on a way to extract generic data from a request in order > to be able to reuse it elsewhere (ACL, stickiness, hashing). So while > I did not thinkg about it, it would then be possible to adapt the > redirect code so that it can use such data too. > > > Atm its only reason why we are still using nginx ;] > > If it's doing that well, you have no reason to replace it. The best > tool for each task provides you with the best architecture. Yeah, but then i miss some (well, a lot of) features I'd want to use that are in haproxy but not in nginx, so either i have to skip some things or do config like haproxy sending some req to nginx only for rewrites, which is kinda ugly. -- Mariusz Gronczewski (XANi) GnuPG: 0xEA8ACE64 http://devrandom.pl signature.asc Description: To jest część wiadomości podpisana cyfrowo
Re: Friendly URLs?
On Wed, Dec 16, 2009 at 01:56:06PM +0100, XANi wrote: > > > 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). > > Its possible to do redirect instead of rewrite ? > so > http://profilename.page.com gets redirected to > http://page/profile/profilename ? If you need to automatically extract "profilename" from the request to build your redirect, then no, it's not possible. But at Exceliance, we're working on a way to extract generic data from a request in order to be able to reuse it elsewhere (ACL, stickiness, hashing). So while I did not thinkg about it, it would then be possible to adapt the redirect code so that it can use such data too. > Atm its only reason why we are still using nginx ;] If it's doing that well, you have no reason to replace it. The best tool for each task provides you with the best architecture. Regards, Willy
Re: Friendly URLs?
Dnia 2009-12-16, śro o godzinie 00:15 +0100, Willy Tarreau pisze: > 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). Its possible to do redirect instead of rewrite ? so http://profilename.page.com gets redirected to http://page/profile/profilename ? Atm its only reason why we are still using nginx ;] as for rewrites, what u really want is you app supporting that kind of address, like Willy said, those are only ugly workarounds -- Mariusz Gronczewski (XANi) GnuPG: 0xEA8ACE64 http://devrandom.pl signature.asc Description: To jest część wiadomości podpisana cyfrowo
Re: Friendly URLs?
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