"error_page"& "return" bug?

Nginx User nginx at nginxuser.net
Sun Feb 19 10:22:34 UTC 2012


Hello,

It appears that the error_page directive is ignored when a status code
is returned  in the server context. (running v1.0.12 Stable).

Server {
	# listen etc
	...
	
	error_page 503 /error_docs/custom503.html;
	return 503
	location /error_docs {
		internal;
		alias /server/path/to/folder;
	}
	
	...
}

Will always return the Nginx default 503 page. Same applies to all status codes.


When the status code is returned within a location block, the custom
page is shown as expected ...

Server {
	# listen etc
	...
	
	error_page 503 /error_docs/custom503.html;
	location / {
		return 503;
	}
	location /error_docs {
		internal;
		alias /server/path/to/folder;
	}
	
	...
}



More information about the nginx mailing list