default handling of reqest

Peter Peter peterko at
Wed May 12 04:15:02 MSD 2010

Hi, thanks for help. As I mentioned in my post, ngx_http_internal_redirect can not be used for this without "ugly" reg ex in config. If I have config like this (alpha omega for me): location ~ '/hello' {insertString;}, where inserString represents my handling command, I would redirect /hello/car.jpg to /hello/aaac/car.jpg, but the same "location" from config would be used again - I suppose it will be endless loop (since /hello/aaac/car.jpg also satisfies my example location rule and something like /hello/aaac/.../aaac/car.jpg would follow).
I do not understand to your trick with ngx_http_subrequest. Image path to file is unique (containing string "aaac").

> ----- Original Message -----
> From: agentzh
> Sent: 05/10/10 04:52 AM
> To: nginx-devel at
> Subject: Re: default handling of reqest
On Sun, May 9, 2010 at 7:50 AM, Peter Peter <peterko at> wrote:
> The module should receive certain requests of images from web f.e.
> /hello/car.jpg and should fetch for file on drive's path /hello/aaac/car.jpg
> (the "aaac" is "somehow" counted from string "car"). Config for this would
> be simple: location ~ '/hello' {insertString;} -- internal redirect is no go
> in this way (I use the same base strings "hello" and I do now want difficult
> regex to be involed in conf file. This way, inserString "makro" would
> indicate to use my module) . I manage insert new path ("aaac") to request
> uri, but I do not know how to continue. I do not want to fetch the file and
> fill headers + body by my self since nginx surely knows how to do it (better
> than me:)). How can I "force" nginx to continue "handling" the request by
> itself with the new uri like I've never modified anything? Thanks.

My gut feeling is to use ngx_http_internal_redirect for this :)

Or you can use ngx_http_subrequest if you want to support multiple
input image files in a single location :)


nginx-devel mailing list
nginx-devel at

More information about the nginx-devel mailing list