Fix hostname validation regex to support localhost and IP addresses #2

Closed
brennoflavio wants to merge 1 commit from claude/fix-hostname-validation-gnQ2B into master
brennoflavio commented 2025-12-26 20:58:08 +00:00 (Migrated from github.com)

The previous regex required at least one dot in the hostname, which prevented users from using localhost, IP addresses, or single-name hostnames.

Updated regex now supports:

  • Domain names (example.com, subdomain.example.com)
  • localhost and single-name hostnames
  • IPv4 addresses (192.168.1.1)
  • IPv6 addresses ([::1], [2001:db8::1])
  • Optional port numbers (:8080)
  • Paths and query parameters

Fixes the first issue in the repository.

The previous regex required at least one dot in the hostname, which prevented users from using localhost, IP addresses, or single-name hostnames. Updated regex now supports: - Domain names (example.com, subdomain.example.com) - localhost and single-name hostnames - IPv4 addresses (192.168.1.1) - IPv6 addresses ([::1], [2001:db8::1]) - Optional port numbers (:8080) - Paths and query parameters Fixes the first issue in the repository.

Pull request closed

Sign in to join this conversation.
No description provided.