Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Eureka Registration when ATTLS (v3) #580

Open
wants to merge 3 commits into
base: v3.x/staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading