Adding the ProxyErrorOverride On
to my virtual hosts does allow me to capture this status code and react appropriately. The problem is this also redirects all of our other status codes.
I'm using a couple small pass throughs to display the contents on the back side if I get a 404 or the like.
ErrorDocument 404 404.html
Contents of 404.html
<html style="height: 100%">
<body style="height: 100%">
<div style="width:100%; height:100%; background-color:transparent;">
<iframe src="https://xxxxx.com/PageNotFound.aspx" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>
</div>
</body>
</html>
Suspect it's your client as it works fine when I curl from my AWS server.
curl -I http://orgasmal.com/r.png
HTTP/1.1 200 OK
Server: nginx/1.6.3
Date: Mon, 29 Aug 2016 19:53:45 GMT
Content-Type: image/png
Content-Length: 224603
Last-Modified: Mon, 29 Aug 2016 17:41:59 GMT
Connection: keep-alive
ETag: "57c473e7-36d5b"
Accept-Ranges: bytes
It also works fine from webpagetest - click to see the result.
Subdomain curl works fine too. I'm not game to click the link from the PC I'm on though.
Update after logs provided
Regarding this piece of configuration
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
The error_page directive says "if there's a 500 error look for the 50x.html page". The location rule says "instead of looking for a static html page, look for the file requested in the /usr/share/nginx/htm directory". This log entry confirms that's what's happening.
"/usr/share/nginx/html/r.png" failed (2: No such file or directory)
It's a pretty weird bit of configuration. I'd remove it entirely and just let the error_page directive and location entirely and just let the server send back appropriate error codes when it finds errors.
Best Answer
It may be that the server does not support ALPN. For example, Debian 8.0 (with OpenSSL 1.0.1k) does only support NPN 2. But Ubuntu 16.04 ship OpenSSL 1.0.2g, which support ALPN, so I'm not sure this is the issue.
I don't think it could cause HTTP 400 errors, except if the server enforce HTTP2.