diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a37b2d5..e36e18ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to the Zlux Server Framework package will be documented in this file.. This repo is part of the app-server Zowe Component, and the change logs here may appear on Zowe.org in that section. +## 2.18.1 +- Bugfix: App-server could not register with discovery server when AT-TLS was enabled for app-server. (#581) + ## 2.17.0 - Enhancement: Added function `isClientAttls(zoweConfig)` within `libs/util.js`. Whenever a plugin makes a network request, it should always use this to determine if a normally HTTPS request should instead be made as HTTP due to AT-TLS handling the TLS when enabled. (#544) - Bugfix: Fixed function `isServerAttls(zoweConfig)` within `libs/util.js`, which was preventing using AT-TLS with app-server. (#544) diff --git a/lib/apiml.js b/lib/apiml.js index afd21566..6c02a188 100644 --- a/lib/apiml.js +++ b/lib/apiml.js @@ -171,9 +171,8 @@ ApimlConnector.prototype = { httpEnabled: false, httpsEnabled: true }; - const proto = 'https'; - log.debug("ZWED0141I", proto, this.port); //"Protocol:", proto, "Port", port); + log.debug("ZWED0141I", 'https', this.port); //"Protocol:", proto, "Port", port); log.debug("ZWED0142I", JSON.stringify(protocolObject)); //"Protocol Object:", JSON.stringify(protocolObject)); const instance = Object.assign({}, MEDIATION_LAYER_INSTANCE_DEFAULTS(proto, this.hostName, this.port)); @@ -183,9 +182,9 @@ ApimlConnector.prototype = { hostName: this.hostName, ipAddr: this.ipAddr, vipAddress: "zlux",//this.vipAddress, - statusPageUrl: `${proto}://${this.hostName}:${this.port}/server/eureka/info`, - healthCheckUrl: `${proto}://${this.hostName}:${this.port}/server/eureka/health`, - homePageUrl: `${proto}://${this.hostName}:${this.port}/`, + statusPageUrl: `https://${this.hostName}:${this.port}/server/eureka/info`, + healthCheckUrl: `https://${this.hostName}:${this.port}/server/eureka/health`, + homePageUrl: `https://${this.hostName}:${this.port}/`, port: { "$": protocolObject.httpPort, // This is a workaround for the mediation layer "@enabled": ''+protocolObject.httpEnabled @@ -228,7 +227,7 @@ ApimlConnector.prototype = { },*/ registerMainServerInstance() { - const overrideOptions = Object.assign({},this.tlsOptions); + const overrideOptions = this.isClientAttls ? {} : Object.assign({},this.tlsOptions) if (!this.tlsOptions.rejectUnauthorized) { //Keeping these certs causes an openssl error 46, unknown cert error in a dev environment delete overrideOptions.cert; @@ -240,7 +239,8 @@ ApimlConnector.prototype = { eureka: Object.assign({}, MEDIATION_LAYER_EUREKA_DEFAULTS, this.eurekaOverrides), requestMiddleware: function (requestOpts, done) { done(Object.assign(requestOpts, overrideOptions)); - } + }, + ssl: !this.isClientAttls } log.debug("ZWED0144I", JSON.stringify(zluxProxyServerInstanceConfig, null, 2)); //log.debug("zluxProxyServerInstanceConfig: " //+ JSON.stringify(zluxProxyServerInstanceConfig, null, 2)) @@ -280,7 +280,12 @@ ApimlConnector.prototype = { }, getServiceUrls() { - return this.discoveryUrls.map(url => url + (url.endsWith('/') ? '' : '/') + 'apps'); + let urls = this.discoveryUrls.map(url => url + (url.endsWith('/') ? '' : '/') + 'apps'); + if (this.isClientAttls) { + return urls.map(url => url.replaceAll('https', 'http')); + } else { + return urls; + } }, getRequestOptionsArray(method, path) {