How to write an IPv6 proxy address in a URL
Colons are part of an IPv6 address, while URI syntax also uses a colon to separate the port. To remove this ambiguity, a literal IPv6 host is enclosed in square brackets inside an authority component. Automated proxy exporters must apply this rule deliberately.
Key points in one minute
- An IPv6 literal in a URI is enclosed in square brackets.
- The port follows the closing bracket.
- Separate application fields may not require URI brackets.
- An IPv4 string template is not safe for IPv6 output.
Why brackets are required
URI authority contains a host and an optional port. Without brackets, a parser cannot reliably distinguish IPv6 colons from the port separator. The brackets belong to URI notation; they are not part of the underlying IP address.
Building the correct form
A complete address contains the scheme, [IPv6], and then a colon and port. If a client format permits username and password in userinfo before @, reserved characters require percent-encoding. Keeping fields separate is safer whenever the application supports it.
URI versus application form fields
Some clients expose separate host and port fields. Their host field may expect IPv6 without brackets because the UI already knows where the port belongs. Follow the client's documentation rather than copying URI notation into every form.
Testing an exporter
Test full and compressed IPv6, IPv6 with a port, credentials containing special characters, and both HTTP and SOCKS5 output. A preview should match the exact copied or downloaded value. Validate one result against an authorized control service.
Practical checklist
- 1Enclose an IPv6 literal in brackets inside a URI.
- 2Place the port after the closing bracket.
- 3Percent-encode reserved characters exactly once.
- 4Check the application's requirements for a host field.
- 5Include IPv6 cases in automated export tests.
Sources and documentation
This material is based on primary, official, and technical sources. The article is an original summary written for this knowledge base.