Rafa_F  
              
                  
                    April 4, 2016,  9:38pm
                   
                  1 
               
             
            
              Hello,
I am struggling to understand the error_page directive behavior:
server {example.org ;
location /proxied {
    return 418 "Host: $host, Connection: $http_connection";
}
}
server {example.com ;
root /var/ious/files;
error_page 418 = /error_page.html;
proxy_intercept_errors on;
location /proxy {
    proxy_pass http://example.org/proxied;
}
}http://example.com/proxy http://example.org/proxied http://example.com/error_page.html 
Observed behavior:http://example.com/proxy http://example.org/proxied 
The error_page.html file exists in the example.com  root directory as
I am running nginx v1.8.1.
 
B. R. 
             
            
              
            
                
           
          
            
              
                B.R  
              
                  
                    April 4, 2016,  9:54pm
                   
                  2 
               
             
            
              On Mon, Apr 04, 2016 at 09:36:36PM +0200, B.R. wrote:
Hi there,
I am struggling to understand the error_page directive behavior:
 
I do not get the full same results that you report, when I use 1.9.2.
Expected behavior:http://example.com/proxy http://example.org/proxied http://example.com/error_page.html 
 
No. Your “error_page” with “=” eats the 418 status.
Observed behavior:http://example.com/proxy http://example.org/proxied 
 
I do get that much.
 → Error page HTTP 404 (???)
 
I only get 404 if error_page.html does not exist. If it does exist,
Aside from that: I suspect that proxy_intercept_errors does exactly the
What happens if you set it “off”?
What am I doing/understanding wrong?
 
error_page normally does not change the http status. Your extra config
Cheers,
 
Francis D.        [email protected] 
             
            
              
            
                
           
          
            
              
                B.R  
              
                  
                    April 4, 2016, 10:13pm
                   
                  3 
               
             
            
              On Mon, Apr 04, 2016 at 08:54:12PM +0100, Francis D. wrote:
On Mon, Apr 04, 2016 at 09:36:36PM +0200, B.R. wrote:
 
Hi there,
-> Error page HTTP 404 (???)
 
I only get 404 if error_page.html does not exist. If it does exist,
Aside from that: I suspect that proxy_intercept_errors does exactly the
 
Apologies - I was wrong there.
“proxy_intercept_errors on;” means that error_page is  used for the
“proxy_intercept_errors off;” means that it is not, and the full
So you had (and have) it the way that you want it to be.
f 
Francis D.        [email protected] 
             
            
              
            
                
           
          
            
              
                B.R  
              
                  
                    April 4, 2016, 10:51pm
                   
                  4 
               
             
            
              Whoops!
As notes, though :
I removed the ‘=’ parameter from the error_page directive to simplify,
Let’s be clear about proxy_intercept_errors:
I should have double/triple/quadruplechecked the configuration before 
B. R.