0

I have setup a custom 404 error page to site on nginx setup.

I have this:

error_page 404 = @ext_404;

location @ext_404 {
    proxy_pass https://www.xexe.com;
    rewrite .* /en-en/test/250/ break;

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host www.xexe.com;
    proxy_set_header X-NginX-Proxy true;
    proxy_redirect off;
    proxy_connect_timeout 1;
    proxy_intercept_errors off;
    expires 30;
}

The solution works as the error page is rendered and the URL on the browser is still the same, but the problem is with the HTTP status code which is 200. How do I force it to be 404? Or is there some other solution to this problem?

My main goal is to get a custom 404 error page from CMS so that users can modify it by them selfs.

Tim
  • 31
  • 3
  • Is the only way to archive this to modify the response status code from www.xexe.com/en-en/test/250/ to be 404? Do nginx offer some way to over-write proxy pass HTTP status code? – Tim Mar 29 '22 at 06:59

0 Answers0