Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My dns zone contains a loopback:

localhost IN A

Do I need it, and if so why? I can't think of a reason to have it here, especially as - without a dot - it would be localhost.example.com

share|improve this question
Curious, I have the same on all my domains. I use a similar record to access my local test server... local IN A - avoids the need to edit the local hosts file and works for all machines on the network. Is this related? – w3dk Dec 27 '12 at 15:56
Not in my case - we use example.local and example.internal as tlds - in the question localhost is a subdomain – adam Dec 27 '12 at 16:07
The same question was asked on ServerFault a while back: serverfault.com/questions/120769/localhost-in-a-dns-zone – w3dk Dec 27 '12 at 17:50
up vote 1 down vote accepted

This answer on ServerFault explains what this localhost entry is for http://serverfault.com/questions/120769/localhost-in-a-dns-zone

localhost.example.com is sometimes included on internal DNS servers to prevent "localhost" requests leaking out to the internet (for the case where John Smith types http://localhost/ in his browser & for whatever reason his resolver doesn't look in the hosts file, appends his search path (example.com) & starts asking name servers what that resolves to).

It also talks about the possibility that such a DNS record could be use for Cross Site Scripting (XSS) attacks and suggest removing it for that reason.

share|improve this answer
Thanks @Stephen, that's great! – adam Feb 25 '13 at 15:58

Did your DNS undergo testing because a many times loopback entry tests ability to process Web requests without actually sending any messages out. I believe it is not needed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.