What is the correct way for a web server to respond to an unrecognized host request?

There are several cases when, for various reasons, user agents make requests to our server for hosts that it is not configured to serve. This currently causes the Plesk page to be pretty disgusting by default, so I'm going to make it a little nicer and faster to load.

It made me think, and I can not find the answer to this online: What is the right way to deal with this situation? Should the server respond with 200, 404 or some other code? Is there an HTTP status code for this situation that I missed?

Finally, as a question of etiquette, what should be done if another server is now located on your server (unlike the domain that we owned but no longer use) (we acquired an additional IP address that was previously used , and lives in some invalid DNS records).

+3
source share
2 answers

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

I would serve 404 and record successes. If you receive a large number of requests for one domain, perhaps you can try to notify the owner of the domain name (if available).

: , , IIS 400 ( ) , .

+3

HTTP , . . - , .

+1

All Articles