Building a rspirep based on the frontend incoming URL

From: Pedro Mata-Mouros Fonseca <pedro.matamouros#gmail.com>
Date: Wed, 26 May 2010 15:26:40 +0100


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?

Thanks in advance.

Pedro. Received on 2010/05/26 16:26

This archive was generated by hypermail 2.2.0 : 2010/05/26 16:30 CEST