User website preference is invalid with underscore

AI-generated summary

User website preference is invalid with underscore

A user is experiencing an error “Website is invalid” when attempting to enter their website (code_man.cybnet.ch) on their profile due to an underscore in the sub-domain. pfaffman confirmed that underscores are not valid characters for hostnames, citing Wikipedia and Stack Overflow.

dGr8LookinSparky suggested introducing an override for admins, but Falco disagreed, citing added complexity. pfaffman recommended pointing the user to resources explaining the issue and suggesting a CNAME using a - instead of a _.

Additionally, Ondrej_Caletka reported a similar issue with Internationalized Domain Names (IDNs) not being accepted, even using Punycode form.

A user on our forums is getting the error “Website is invalid.” when attempting to enter his website on his profile.

The url he is using is:

code_man.cybnet.ch

Perhaps the underscore in the sub-domain is triggering the error?

The version of Discourse that we are currently using is:

1.5.0.beta14

It seems this topic might be related:

That’s it. Underscores are not valid characters for hostnames.

But the url works. Perhaps this validation could be overridden by admins if they entered the url?

Introduce complexity on the URL validation to let some people who wants a invalid domain on their profile? I don’t think this is a good idea.

Well, if that were entirely true, we wouldn’t be having this conversation. :slight_smile:

https://www.quora.com/Why-are-underscores-not-allowed-in-DNS-host-names

The best solution, in my arrogant computer geek opinion, would be to point the guy to the above web sites and suggest to the guy that he’s doing it wrong and that if he wants to link to his site he should create a CNAME using a - instead of a _. (You’d probably want to find a nicer way to say that.)

And what about IDNs? The regular expression validating the website url is so strict that I can’t fit in my perfectly valid URL https://ondřej.caletka.cz

Even using Punycode form of https://ondřej.caletka.cz is not accepted, even though it is perfectly valid here in this very forum post.