rewrite_module patch: 'if (-z)' checks for zero-length files

dap nginx-forum at nginx.us
Thu Oct 15 17:00:22 MSD 2009


Hi!

I've a heavy loaded reverse proxy for large video files on nginx/http_proxy_module. Sometimes I cache a zero-length file due to a problem of the upstream server and it's a headache for my client. I found that, the "if" conditions of the rewrite module doesn't support checks based on file size, so I wrote some code for that, you can found as a diff for 0.7.62 here: http://pastebin.com/m793679da  -It's a lightweight modification, I think it could go into mainline.


[...]
location / {
[...]
  # if (!-f $request_filename) {   # damned empty cached files,
  if (-z $request_filename) {      # bye, bye! :)
    proxy_pass http://indavideo;
  }
[...]
}
[...]


Thanks for your great work,
--
 Roland Pallai
 Sysadmin at Indavideo.hu

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,13944,13944#msg-13944






More information about the nginx mailing list