URLField not recognising domain:port pattern

I have been using the URLField as:

url_attrs = {
        'placeholder': 'Url acceso',
        'maxlength': Dispositivo.URL_MAX_LENGTH,
}
url_access = forms.URLField(widget=forms.URLInput(attrs=url_attrs), label='Url acceso', label_suffix='', required=False)

When trying an url like https://hello:123/url, I get an error telling that it’s not a valid url . On the other hand something like https://123.123.123.123:68/url works. These is intended or a bug? I mean it’s a working url as far as my knowledge goes. Example: Resource URLs - Veeam Backup REST API Reference, if the machines name is skyrim-01 then the url will be: https://skyrim-01:224/console

This behavior can be considered to be intended based upon the resolution of #9202 (forms.field.URLField regexp for validating URL does not follow the RFC) – Django, and #25418 (URL Validator to check only hostname part without domain nor tld) – Django

This second ticket also references the conversation at https://groups.google.com/g/django-developers/c/ASBJ0ge2KYo?pli=1, which is an informative read.

Note: The presence or the absence of the port doesn’t affect this. This validator won’t accept http://hello/ as valid, either.

Hello @KenWhitesell, thank you for the information, it’s understandable and probably for the best to use regex when you want something more custom or extensive. Very helpfull!