error_page custom 404 page

nanaya me at nanaya.net
Wed Jun 12 14:39:02 UTC 2024


Hi,

On Wed, Jun 12, 2024, at 22:47, Marcello Lorenzi wrote:
> error_page 404 =404 https://$host/404/;
> 
> We noticed that the client receives a 302 code from the initial page to the 404 page and the 404 page gives a 200 code. Into the access_log we can't identify the 404 errors.
> 

As per documentation when a url is defined for error page:

> In this case, by default, the response code 302 is returned to the client. It can only be changed to one of the redirect status codes (301, 302, 303, 307, and 308).

Either make it just /404/, or if it's on a different server, make an internal location block which proxies to that page.



More information about the nginx mailing list