M
M
Maxim Grechushnikov2014-10-22 11:51:04
Nginx
Maxim Grechushnikov, 2014-10-22 11:51:04

nginx. 404 error. How right?

The question is:
when the page does not exist, nginx redirects to 404.php, but the problem is that the page is returned with a 200 OK status. if I specify to give 404 header in 404php, then nginx goes into recursion. How to force nginx to return status 404? if anyone cares - I use nginx boilerplate.
error_page 404 $document_root/404.php;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kompi, 2014-10-22
@maxyc_webber

This is logical, the response from the proxy is 200, since 404.php was found. Try this error_page 404 = $document_root/404.php;
It works for me with one line in 404.php:
header('HTTP/1.0 404 Not Found');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question