You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by vr...@apache.org on 2017/08/01 04:49:11 UTC

[apex-core] branch master updated: APEXCORE-760 Use FQDN for webapp tracking URL

This is an automated email from the ASF dual-hosted git repository.

vrozov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apex-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 6cdb92b  APEXCORE-760 Use FQDN for webapp tracking URL
6cdb92b is described below

commit 6cdb92bf5ad98a90d6881dcaa854e4c8a9e70361
Author: Thomas Weise <th...@apache.org>
AuthorDate: Tue Jul 18 14:39:52 2017 -0700

    APEXCORE-760 Use FQDN for webapp tracking URL
---
 .../java/com/datatorrent/stram/StreamingAppMasterService.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java b/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
index 63080bb..fb39d6c 100644
--- a/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
+++ b/engine/src/main/java/com/datatorrent/stram/StreamingAppMasterService.java
@@ -634,8 +634,15 @@ public class StreamingAppMasterService extends CompositeService
       Configuration config = SecurityUtils.configureWebAppSecurity(getConfig(), dag.getValue(Context.DAGContext.SSL_CONFIG));
       WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr));
       LOG.info("Started web service at port: " + webApp.port());
-      appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getHostName() + ":" + webApp.port();
-
+      // best effort to produce FQDN for the client to connect with
+      // (when SSL is enabled, it may be required to match the certificate)
+      connectAddress = NetUtils.getConnectAddress(webApp.getListenerAddress());
+      String hostname = connectAddress.getAddress().getCanonicalHostName();
+      if (hostname.equals(connectAddress.getAddress().getHostAddress())) {
+        // lookup didn't yield a name
+        hostname = connectAddress.getHostName();
+      }
+      appMasterTrackingUrl = hostname + ":" + webApp.port();
       if (ConfigUtils.isSSLEnabled(config)) {
         appMasterTrackingUrl = "https://" + appMasterTrackingUrl;
       }

-- 
To stop receiving notification emails like this one, please contact
['"commits@apex.apache.org" <co...@apex.apache.org>'].