4

What HTTP status code should an unconfigured vhost domain name return?

I have a vhost setup where I catch all unconfigured domains into a default vhost and serve a page informing that it is unconfigured.

Should I return a http error code to inform the client that something went wrong, and perhaps to keep the page from getting indexed? Or should I just return 200 and use robots.txt?

3 Answers 3

1

Use a boilerplate HTML file and robots.txt - if you may not get around to implementing the domain, it could help to have your contact details posted so potential buyers can reach you (particularly if you use a WHOIS proxy registration).

1
  • I guess I should disable the DNS altogether for domains I want out of reach. Oct 4, 2010 at 2:48
4

404 (Not found) is just fine:

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

In your case, there's nothing matching the URI in your vhost (yet).

Of course, you can return a page saying whatever you want at the same time, it doesn't have to be the default error page.

2

Of the list of HTTP status codes, it seems that 501 - Not Implemented may be the most appropriate. Honestly, I don't think it matters a whole lot, though. For my catch-all vhosts, I typically just serve a blank index.html. No legit user is going to end up there anyway, so anything that falls through to the default vhost is either a malicious script/bot, or someone who is just poking around and doesn't really need a real error code.

2
  • I suppose an empty document is an effective way of preventing indexing :P Oct 3, 2010 at 4:47
  • 501 refers to the request not being recognised or the method not being understood (see RFC 2616: "This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource. "). In this case, the request to an unconfigured vhost is understood (presumably we're talking of a GET at least), the resource is just not there.
    – Bruno
    Oct 3, 2010 at 11:42

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.