Check for existing remote files
Mikhail Mazursky
ash2kk at gmail.com
Thu Jan 13 14:48:13 MSK 2011
2011/1/13 mignev <nginx-forum at nginx.us>:
> First thanks for the critique. Such types of solutions are many, but I
> don't want such solution. In my case i have over a million images of
> which i don't know the name or their existence. I want to try for
> existence of requested file and if he is found then return to me. If the
> requested file is not exist go to my proxy_pass $mybackend; and he will
> generate and upload it. WIth this idea i want to skip database layer. I
> have some ideas how i can do that but firstly i want to hear your
> feedback about that.
server {
....
location ~ ^/remote/(?<remote_url>.+)$ {
proxy_intercept_errors on;
error_page 404 = @mybackend;
proxy_pass http://$remote_url;
}
location @mybackend {
proxy_pass http://mybackend_upstream;
}
}
This shows the general idea about how to do this, but i haven't tested
so there may be syntax errors.
More information about the nginx
mailing list