Using nginx as a frontend to our modperl apache2 servers.

We have a soft 404 problem at Google Search Console.

The problem is that we have many pages expiring all the time, once they expire we add a noindex robots tag immediately, show a "no longer available" screen to the viewer but are unable to send a 404 header to Google as nginx sends the header and the header is a 200 as the page is served ok in its eyes.

How can I tell apache to notify nginx to send a 404 header?


Use error_page directive and add this code:

  server {
      error_page 404 /404.html;
      location = /404.html {
        root   /usr/share/nginx/html;
        add_header Cache-Control "no-cache" always;
  • How would we get nginx to send the 404 after receiving the 200 from apache? May 17 '16 at 16:47
  • add that in error page because it adds another header.
    – Josip Ivic
    May 18 '16 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.