How to tell Proxy module to retrieve secondary URL if primary URL doenst exist

Maxim Dounin mdounin at
Thu Oct 4 09:45:44 UTC 2012


On Wed, Oct 03, 2012 at 05:00:39PM -0400, wurb32 wrote:

> Hi all,
> I am using nginx's Proxy module to retrieve images from Amazon S3. I need to
> be able to tell the Proxy module to retrieve a smaller sized file if a
> bigger sized file doesnt exist. How can I do that? 
> For instance, my nginx configuration:
> 	location / {
>             proxy_pass;
>             error_page   415 = /empty;
> 	}
> Say I have image1_100.jpg on S3 then http://localhost/image1_100.jpg works
> fine. However http://localhost/image1_300.jpg wont work. I want to be able
> to ask nginx to request the 
> file and if it doesnt
> exist, request for iamge1_100.jpg file instead.

Use error_page 404 and proxy_intercept_errors, see

Maxim Dounin

More information about the nginx mailing list