Skip to content

Commit

Permalink
Merge pull request #580 from zowe/bugfix/v3/eureka-attls
Browse files Browse the repository at this point in the history
Fix Eureka Registration when ATTLS (v3)
  • Loading branch information
1000TurquoisePogs authored Jan 6, 2025
2 parents 948e0dd + 5f84184 commit fa4341b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

## 3.1.0
- Bugfix: App-server could not register with discovery server when AT-TLS was enabled for app-server. (#580)

## 3.0.0
- Enhancement: Add ability for server to dynamically load plugin web content based on `entryPoint` specification in the
`pluginDefinition.json`
Expand Down
21 changes: 13 additions & 8 deletions lib/apiml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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))
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fa4341b

Please sign in to comment.