error_page behavior

B.R. reallfqq-nginx at yahoo.fr
Mon Apr 4 19:36:36 UTC 2016


Hello,

I am struggling to understand the error_page directive behavior:

​server {
    listen      80;
    listen      [::]:80;
    server_name example.org;

    location /proxied {
        return 418 "Host: $host, Connection: $http_connection";
    }
}

server {
    listen      80;
    listen      [::]:80;
    server_name example.com;

    root /var/ious/files;

    error_page 418 = /error_page.html;
    proxy_intercept_errors on;

    location /proxy {
        proxy_pass http://example.org/proxied;
    }
}
​
​Expected behavior:
->Request to http://example.com/proxy
    -> Sub-request to http://example.org/proxied
    -> Response HTTP 418
-> Error page for HTTP 418 served http://example.com/error_page.html

Observed behavior:
-> Request to http://example.com/proxy
    -> Sub-request to http://example.org/proxied
    -> Response HTTP 418
-> Error page HTTP 404 (???)

​The error_page.html​ file exists in the example.com root directory as any
other file.
No error message in the error_log file (warn level).

​I am running​ nginx v1.8.1.

​What am I doing/understanding wrong?​
---
*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160404/20922557/attachment.html>


More information about the nginx mailing list