I have a, let's call it, "legacy" VHost configured on an nginx server. It used to be a full site, but it has since been decommissioned and all the content removed. The server block now looks something like this:

server {
    listen 80;
    server_name defunct-site.com;
    return 410;

There are DNS records and applications which are out of my control that still point to this server, and it still gets relatively significant traffic despite my pleads to the third party to update their configuration and stop trying to hit the site. Needless to say, I can't change my IP address without significant pointless effort.

Is there a stronger way to tell these clients that their traffic is no longer welcome here? The source IPs are all over the place, so doing a successful iptables block seems unlikely. And I need to read enough of the HTTP request to get to the Host: header to make sure I'm not clobbering traffic intended for a legitimate VHost.

  • You could use return 444 to close connection without answer. I doubt that you could do something more than that. – Alexey Ten Jul 15 '15 at 14:13

410 Gone is the canonical error to return for content which no longer exists and is known to never be returning. In particular, it also tells search engines this, so that they can lower the ranking of, or delist, such URLs.

One additional thing you can do is to provide an error_document for it, to explain to people who visit the site what is going on. Without it, all they will see is an uninformative "410 Gone". For instance:

error_document 410 /410.html;

This will be just a static HTML document that contains whatever you wish, and you can be as rude as you like.

<h1>Go away</h1>
<p>You aren't supposed to be here. This is Initech's fault, yell at
John Doe on +1 212 555-1234.</p>
| improve this answer | |

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.