kingluo commented on issue #7563: URL: https://github.com/apache/apisix/issues/7563#issuecomment-1200433318
> @kingluo Thanks for your analysis. > > Is it possible to support IPv6 without bracket? Support this format will be great so people don't need to deal with the Nginx's special behavior. No, it's not nginx specific. In convention, to concatent with the port, the ipv6 must be quoted with bracket. So nginx does the right thing. In fact, here the issue is not only triggered by nginx only. When apisix constructs the balancer, it would merge the address and port of each upstream as server url. After the server picker picks a server, it would parse the server url back into host and port. But since the address part of the server url is not quoted with brackets, it would fail to parse the ipv6 address, then leave the host value as the same server url value (2409:XXXX:XXXX:2000:0:1:afd:7d65:4009), and port is nil! Check https://github.com/apache/apisix/blob/master/apisix/balancer.lua#L193 and https://github.com/apache/apisix/blob/master/apisix/core/utils.lua#L156 for codes. Then when it passes the host to nginx, nginx would treat it as ipv4 address and raise error. In the output by @topzyh, he modifies the codes to quote the host with brackets in the wrong place, then it comes in another story: nginx try to parse it as ipv6 address, and find it's in wrong format (with extra port in tail). And in fact, in our ipv6 test, the input host is quoted with brackets, so it passes. So all in all, in my opinion, the solution is, either we adjust the admin API to quote the ipv6 address automatically, or we require the user to quote the ipv6 address with brackets. It's a bug in our codes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
