Re: Building a rspirep based on the frontend incoming URL

From: Pedro Mata-Mouros Fonseca <pedro.matamouros#gmail.com>
Date: Thu, 27 May 2010 10:56:01 +0100


Thanks so much Willy. Looking forward for that, there'd be two or three cool things you could do with that then.

Pedro.

On May 27, 2010, at 6:21 AM, Willy Tarreau wrote:

> On Wed, May 26, 2010 at 03:26:40PM +0100, Pedro Mata-Mouros Fonseca wrote:

>> Greetings,
>> 
>> For a given image serving backend I use a reqrep to rewrite an incoming scrambled URL and pass it on unscrambled:
>> reqrep  ^(GET[^\ ]*)\ /image/\w{1}(\w{2})(\w{2})(\w{2})(.*)    \1\ /storage\5/images/\3/\4\2
>> 
>> In the response should be the corresponding requested image. Since these backend image servers have different configurations and setups (some use Nginx, some use Apache + Squid, etc), I use a rspirep to pick up any 4xx errors and throw the client a vanilla standardized error page instead:
>> rspirep ^(HTTP/...)\ 4[0-9][0-9].*    \1\ 400\ Bad\ Request\nContent-Length:\ 74\nContent-Type:\ text/html\n\n<FRAMESET...............[SNIP]
>> 
>> So far so good, but I'd like to take that a step further: somewhere on the incoming URL (\w{1}) there's a single char that indicates the fixed dimensions of the requested image. I'd like to use that to serve a "not available" image with the exact same dimensions that are showed in the incoming URL. So basically the question is: is it possible in the rspirep to have access to the URL processed in reqrep or even the rewritten one?

>
> No, right now it's not possible to use any request content in the
> response. This is something we'll try to get working in 1.5.
>
> Regards,
> Willy
>
>
>
Received on 2010/05/27 11:56

This archive was generated by hypermail 2.2.0 : 2010/05/27 12:00 CEST