Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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)


share|improve this question
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 '13 at 6:13
localhost is a shortcut to that's the reason it's considered "numeric domain". – Shadow Wizard Feb 14 '13 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) – Shadow Wizard Feb 14 '13 at 11:42
@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. – Eliah Kagan Feb 14 '13 at 16:23
up vote 13 down vote accepted

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).

share|improve this answer
What about "try a non-numeric and non-local domain"? For most people, "localhost" doesn't appear to be numeric/IP. – Shadow Wizard Feb 14 '13 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. – Marc Gravell Feb 14 '13 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! – Shadow Wizard Feb 14 '13 at 12:06
@ShaWizDowArd yes; the code that detects the scenario and generates the error message has been changed. The test itself is not new. – Marc Gravell Feb 14 '13 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 '14 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.

share|improve this answer
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:… – DrumEater Apr 28 '14 at 21:07
Use `localhost`. – kiamlaluno Apr 29 '14 at 0:37
Enclosing it in bacticks was the trick. Much obliged, kiamlaluno. – DrumEater Apr 29 '14 at 13:41

You must log in to answer this question.

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