Re: URL rewriting?

From: Willy Tarreau <w#1wt.eu>
Date: Tue, 2 Sep 2008 21:41:12 +0200


Hello Chris,

On Wed, Aug 27, 2008 at 11:02:51AM -0700, Chris Charman wrote:
> I'm trying to see if I can do URL rewriting on the backend. First of all, is
> that possible?

yes, it is.

> Here's a snippet of my config:
>
> backend data
> mode http
> log global
> # Rewrite the request to map old URLs to new services
> URLs.
>
> reqirep ^(GET\ .*)(/BzServices.*)?(.*)(clientredirurl)(.*$)
> \1/services/redirect/?\3\4
>
> reqirep ^(POST\ .*)(/BzServices.*)?(.*)(clientredirurl)(.*$)
> \1/services/redirect/?\3\4
>
> reqirep ^(GET\ .*)(/BzServices/DemographicQuery.aspx)?(.*$)
> \1/services/query/?\3
>
> reqirep ^(POST\ .*)(/BzServices/DemographicQuery.aspx)?(.*$)
> \1/services/query/?\3
>
> reqirep ^(GET\ .*)(/BzServices.*)?(.*$)
> \1/services/collect/?\3
>
> reqirep ^(POST\ .*)(/BzServices.*)?(.*$)
> \1/services/collect/?\3
>
> option httpchk HEAD /__LB_TEST.html
> server host01 hostname:port check
> server z_nothing localhost:18000 backup check
> # end backend data
>
> Here's what I'm getting in the logs:
> Aug 27 17:54:44 localhost.localdomain haproxy[24655]:
> 66.7.250.234:62186[27/Aug/2008:17:54:44.391] http_in data/<NOSRV>
> -1/-1/-1/-1/3 400 187 - -
> PR-- 0/0/0/0/0 0/0 {data.mydomain.co|Mozilla/5.0 (Mac||} {} "GET
> /BzServices/Redirect.aspx?partnerid=42 HTTP/1.1"
>
> Is this even possible? It doesn't seem to matter if I put the rewrite rules
> in the frontend or the backend.
>
> Do I need to point this at an http server running mod_rewrite or something?

No, there are several things you have to consider :

Regards,
Willy Received on 2008/09/02 21:41

This archive was generated by hypermail 2.2.0 : 2008/09/02 21:45 CEST