Search code examples
dnshttp-status-codes

What to return to browser if DNS lookup failed?


Disclaimer: not sure if this is SO material. If not, please move it to the appropriate place.

I'm trying to build a web proxy, and I'm unsure what to return to the browser, if the DNS lookup failed (ie. if the domain does not exist). Is there a HTTP status code for this? I tried looking in the Network tab in Chrome, but there's no response for a failed DNS lookup.


Solution

  • There wouldn't be an HTTP code for it, since by definition an HTTP request couldn't be done in the first place is the server's IP couldn't be resolved. Probably the easiest-to-use-instead would be 404 - "not found" or 404.1 - "site not found" if you have IIS 7.0+.