title: nginx image_filter return 415, expected 404
body: <p>I have an Nginx working as a upstream </p>
  
  <pre><code>upstream img_servers {
      server localhost:8000;
      server localhost:8001 backup;
  }
  </code></pre>
  
  <p>I'm expecting the server listening on 80 would try the 2 servers in the upstream. When the file is not found, it should try the other one.<br>
  What I'm doing is</p>
  
  <pre><code>location ~ (jpg|jpeg|png|gif)$ {
      proxy_pass http://img_servers;
      proxy_next_upstream http_404;
  }
  </code></pre>
  
  <p>However, the upstream server used the image_filter module, and when some image is not found, it always returns 415.</p>
  
  <pre><code>server {
      listen       8000;
  
      access_log  logs/access_8000.log  main;
      error_page 415 =404 /empty.gif;
      location ~ (sku_\d+(\d)(\d)(\d)_\d+)_(thumb|small)\.(jpg|png|jpeg|gif)$ {
          alias /srv/http/media/$2/$3/$4/$1.$6;
          image_filter resize 150 -;
          image_filter_buffer 2M;
      }
  }
  </code></pre>
  
  <p>So when the code runs into the location, and the file doesn't exist, it returns 415 to the proxy. I'm expecting to return 404 so that proxy knows to try the next upstream server. According to the document of <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page" rel="nofollow">error_page</a> I'm expecting to achieve this by:</p>
  
  <pre><code>error_page 415 =404 /empty.gif;
  </code></pre>
  
  <p>I don't know why this doesn't work for me. Any suggestions? </p>