<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Hello,<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I am struggling to understand the error_page directive behavior:<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">server {<br> listen 80;<br> listen [::]:80;<br> server_name <a href="http://example.org">example.org</a>;<br><br> location /proxied {<br> return 418 "Host: $host, Connection: $http_connection";<br> }<br>}<br><br>server {<br> listen 80;<br> listen [::]:80;<br> server_name <a href="http://example.com">example.com</a>;<br><br> root /var/ious/files;<br><br> error_page 418 = /error_page.html;<br> proxy_intercept_errors on;<br><br> location /proxy {<br> proxy_pass <a href="http://example.org/proxied">http://example.org/proxied</a>;<br> }<br>}<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Expected behavior:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">->Request to <a href="http://example.com/proxy">http://example.com/proxy</a><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"> -> Sub-request to <a href="http://example.org/proxied">http://example.org/proxied</a><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"> -> Response HTTP 418<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">-> Error page for HTTP 418 served <a href="http://example.com/error_page.html">http://example.com/error_page.html</a><br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Observed behavior:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">-> Request to <a href="http://example.com/proxy">http://example.com/proxy</a><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"> -> Sub-request to <a href="http://example.org/proxied">http://example.org/proxied</a><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"> -> Response HTTP 418<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">-> Error page HTTP 404 (???)<br></div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">The error_page.html file exists in the <a href="http://example.com">example.com</a> root directory as any other file.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">No error message in the error_log file (<span style="font-family:monospace,monospace">warn</span> level).<br></div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I am running nginx v1.8.1.<br></div><br><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">What am I doing/understanding wrong?</div><div><div class="gmail_signature"><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div></div>
</div>