From 64c89b6874a0c72df15397db779ecb817885be35 Mon Sep 17 00:00:00 2001 From: Jeff Mesnil Date: Wed, 3 May 2017 09:56:24 +0200 Subject: [PATCH] [ARTEMIS-1043] Support IPv6 in NettyConnector Wrap the host added to the HTTP request headers with IPV6Util.encloseHost to ensure that load balancers that reads the header will have a valid IPv6 address. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-1043 --- .../artemis/core/remoting/impl/netty/NettyConnector.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index e1c7bd6fff..0b0d840564 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -659,9 +659,10 @@ public class NettyConnector extends AbstractConnector { if (sslEnabled) { scheme = "https"; } - URI uri = new URI(scheme, null, IPV6Util.encloseHost(host), port, null, null, null); + String ipv6Host = IPV6Util.encloseHost(host); + URI uri = new URI(scheme, null, ipv6Host, port, null, null, null); HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uri.getRawPath()); - request.headers().set(HttpHeaders.Names.HOST, host); + request.headers().set(HttpHeaders.Names.HOST, ipv6Host); request.headers().set(HttpHeaders.Names.UPGRADE, ACTIVEMQ_REMOTING); request.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.UPGRADE); final String serverName = ConfigurationHelper.getStringProperty(TransportConstants.ACTIVEMQ_SERVER_NAME, null, configuration);