1

With Apache we've sometimes made use of the 410 GONE http status code to indicate that resources have gone away to crawlers etc alongside an html page for human visitors.

We've either used something like:

ErrorDocument 410 ourmovedpage.html
...
Redirect gone /GONECONTENT

And the server provides the 410 status code along with showing browser visitors the 'ourmovedpage' address.

With Nginx, I've tried

location = /gonecontent-address {
  error_page 404 =410 $scheme://ourdomain/ourmovedpage.html;
}

but in testing that Chrome seemed to be displaying a 302 redirect status code, instead of the 410 I'm after.

Has anyone come up with something similar for Nginx to send a 410 but also return a nice page for human visitors?

Douglas
  • 11
  • 2

1 Answers1

0

By specifying a full URL nginx is forced to perform a redirect. You should specify the human readable page relative to the current server.

location = /gonecontent-address {
    error_page 404 =410 /ourmovedpage.html;
}
Richard Smith
  • 45,711
  • 6
  • 82
  • 81
  • Thanks. This helped my understanding of both Apache + NGINX, and provided the solution as well. – Douglas Apr 10 '17 at 04:16