skip to Main Content

There are a few cases where, for various reasons, user agents make requests to our server for hosts that it is not configured to serve. Currently this results in them seeing the default Plesk page which is rather hideous, so I’m going to be making a slightly prettier and faster-to-load replacement.

This got me thinking, though, and I can’t find an answer to this online: What is the correct way to handle this situation? Should the server be responding with a 200, a 404, or some other code? Is there an HTTP status code for this situation that I’ve overlooked?

Lastly as a question of etiquette, what should be done in the event someone else’s domain (as opposed to a domain we owned but no longer use) points at your server now (we acquired an extra IP address which was previously in use, and lives on in some incorrect DNS records).

2

Answers


  1. The HTTP status codes apply to resources not domain names. The behavior is unspecified. My preference would be to redirect to a static web page with an explanation rather then send them elsewhere in the internet.

    Login or Signup to reply.
  2. IMHO, if user agents make a request to your server about a domain that you are not serving, then a 404 (not found) seems the most logical to me. After all the domain (and any page associated with it) does not exist on (your) server.

    I would serve the 404 and log the acccesses. If you receive a high number of requests for one domain, then maybe you could try notifying the owner of the domain name (if reachable).

    Edit: If the problem is the host-name header being incorrect, then I think at least IIS will return a 400 (bad request) as a response, which might be an alternative in this case.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search