Skip to content

Commit

Permalink
Fix Proxy Config bindAddress does not working for servicePort (apache…
Browse files Browse the repository at this point in the history
…#9068)

The proxy config bindAddress, only works for webPort, does not work for the servicePort.
  • Loading branch information
Shoothzj authored Dec 29, 2020
1 parent 19ff4c3 commit 29921a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions conf/proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ zooKeeperCacheExpirySeconds=300

### --- Server --- ###

# Hostname or IP address the service binds on, default is 0.0.0.0.
bindAddress=0.0.0.0

# Hostname or IP address the service advertises to the outside world.
# If not set, the value of `InetAddress.getLocalHost().getHostname()` is used.
advertisedAddress=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void start() throws Exception {
// Bind and start to accept incoming connections.
if (proxyConfig.getServicePort().isPresent()) {
try {
listenChannel = bootstrap.bind(proxyConfig.getServicePort().get()).sync().channel();
listenChannel = bootstrap.bind(proxyConfig.getBindAddress(), proxyConfig.getServicePort().get()).sync().channel();
LOG.info("Started Pulsar Proxy at {}", listenChannel.localAddress());
} catch (Exception e) {
throw new IOException("Failed to bind Pulsar Proxy on port " + proxyConfig.getServicePort().get(), e);
Expand All @@ -187,7 +187,7 @@ public void start() throws Exception {
if (proxyConfig.getServicePortTls().isPresent()) {
ServerBootstrap tlsBootstrap = bootstrap.clone();
tlsBootstrap.childHandler(new ServiceChannelInitializer(this, proxyConfig, true));
listenChannelTls = tlsBootstrap.bind(proxyConfig.getServicePortTls().get()).sync().channel();
listenChannelTls = tlsBootstrap.bind(proxyConfig.getBindAddress(), proxyConfig.getServicePortTls().get()).sync().channel();
LOG.info("Started Pulsar TLS Proxy on {}", listenChannelTls.localAddress());
}

Expand Down

0 comments on commit 29921a6

Please sign in to comment.