On Fri, 2015-01-23 at 16:05 -0500, Christopher Schultz wrote: > > > > If only one address per Connector can be specified, can you not > > just use 2 <Connector>s, one for each ? They should not conflict. > > That should definitely work (address="127.0.0.1" and address="::") but > one connector might be nice. > > Maybe Tomcat could detect some magic value that is invalid for an > address (like "loopback") and then use > InetAddress.getLoopbackAddress() instead of a traditional address > lookup/resolution. >
Just thought I'd provided a bit more details for completeness sake. Even InetAddress.getLoopbackAddress isn't perfect. What Jess left out of his original description is that we really ideally wanted to simply leave mod_jk configured to use localhost instead of an IP address. We incorrectly assumed localhost = 127.0.0.1. I forgot that localhost can also resolve to ::1 (for some reason I had it in my head that localhost6 would be used for ::1) So really, without using an IP address on both mod_jk and tomcat side, there's no good way to synchronize the two configurations. It appears a proper getAddrInfo implementation uses RFC 6724 to declare preference which means it prefers ipv6 addresses. Java however by default for backward compatibility prefers ipv4: http://docs.oracle.com/javase/8/docs/technotes/guides/net/ipv6_guide/#ipv6-related So localhost to apache+mod_jk on a ipv4/ipv6 system = ::1 and localhost (or InetAddress.getLoopbackAddress) on a Java VM by default is 127.0.0.1. Without either tweaking gai.conf (on Linux, who knows what it is on the other unix platforms) or setting -Djava.net.preferIPv6Addresses=true on java, native code and java code unfortunately will have differing opinions on what ip address is localhost/loopback. The two connectors idea is an interesting one, but that has the unfortunate aspect of now maintaining 2 separate thread pools complicating performance tuning a little bit especially if you can't predict exactly which connector the mod_jk side might be using if we rely on an "ambiguous" localhost value. Be nice if Java simply implemented RFC 6724 properly. Andy