I understand the reasoning for the error message, I'm just a little unsure about the wording of it:

Links cannot contain 'localhost' (try a non-numeric domain)


  • 3
    At a guess, the error message is "Links cannot contain '{badurl}' (try a non-numeric domain)", and someone added localhost to the list of bad-urls...
    – Benjol
    Feb 14, 2013 at 6:13
  • localhost is a shortcut to that's the reason it's considered "numeric domain". Feb 14, 2013 at 11:40
  • @Benjol any URL which contains the IP address of a server can't be inserted to posts as link, not even valid. The validator doesn't perform any "ping" just block any URL of that kind. (try it yourself: which point to Stack Exchange server yet can't be inserted to posts) Feb 14, 2013 at 11:42
  • 3
    @ShaWizDowArd Every valid host/domain name is a shortcut to an IP address. If you're saying localhost is just shorthand (an abbreviation?) for, that's not the case; it sometimes resolves to ::1. I'm not saying localhost URLs should be allowed, but there's no good reason for this particular error message to be shown. Feb 14, 2013 at 16:23

2 Answers 2


Ultimately, you're adding a link to your post that nobody will be able to click on; all it is saying is: it doesn't make much sense as a hyper-link, but will be fine for example as code: http://localhost:8080/whatever.

We have, however, changed the error message to:

Links cannot contain 'localhost' (try a full domain or wrap it in a code block).

  • 6
    What about "try a non-numeric and non-local domain"? For most people, "localhost" doesn't appear to be numeric/IP. Feb 14, 2013 at 12:01
  • @ShaWizDowArd agreed; this relates to some recently edited code - and I just want to check the intent with the author before diving in and hacking it. Feb 14, 2013 at 12:03
  • Wasn't this filter in place from the beginning? I'm pretty sure I tried to enter link to http://[IP-Address] long ago and saw this exact message. Anyway, glad you agree thanks! Feb 14, 2013 at 12:06
  • 3
    @ShaWizDowArd yes; the code that detects the scenario and generates the error message has been changed. The test itself is not new. Feb 14, 2013 at 12:08
  • I'm not adding a link, I'm adding text that describes the scenario. Stackoverflow is interpreting some text that looks like an url to be a link. It should apply the check when deciding whether to treat an url as a link- and not when it determines if my post is valid.
    – fschwiet
    May 9, 2014 at 23:59

I would use the following error message:

Links cannot contain 'localhost' (try another, non-numeric domain)

This should make clear the user needs to try with another domain that is not numeric.


The error message has been changed as follows:

Links cannot contain 'localhost' (try a full domain or wrap it in a code block).


That at least is the message you get when the URL contains localhost as domain name.

  • How do we actually wrap a localhost address in code to use it in stackexchange? I've tried indenting it with four spaces, enclosing it in <pre or <code, and keep getting the above error. Reference: askubuntu.com/questions/452524/…
    – DrumEater
    Apr 28, 2014 at 21:07
  • Use `localhost`.
    – apaderno
    Apr 29, 2014 at 0:37
  • Enclosing it in bacticks was the trick. Much obliged, kiamlaluno.
    – DrumEater
    Apr 29, 2014 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .