Check for existing remote files

Reinis Rozitis r at roze.lv
Thu Jan 13 13:51:00 MSK 2011


> how can i check http://www.google.com/logo.png or
> http://dl.dropbox.com/u/3720261/testdir/file.zip

Well it depends what yout want to do after checking if the file does or 
doesnt exist.

If you just want to serve the remote file and fall back to some backup 
location/host you can technically use proxy_pass (define 2 or more upstream 
( http://wiki.nginx.org/HttpUpstreamModule ) servers which to check first 
(your own you can define as 'backup')) with proxy_next_upstream http_404; 
option ( http://wiki.nginx.org/HttpProxyModule#proxy_next_upstream ).

For something more sophiscated scenario you would need to write either perl 
module or just rewrite the requests to a php script for example.

rr 




More information about the nginx mailing list