Skip to content

Commit

Permalink
Merge pull request wso2#391 from chanaka3d/supportFix1
Browse files Browse the repository at this point in the history
Fixing error after configuring proxy context path
  • Loading branch information
chanaka3d authored Dec 2, 2022
2 parents 34cc262 + a763f32 commit 7c14cd9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
response.addCookie(cookie);
cookie = new Cookie("AM_ACC_TOKEN_DEFAULT_P2", accessTokenPart2);
cookie.setPath("/api/am/service-catalog/v1/");
cookie.setPath(proxyContext != null ? proxyContext + "/api/am/service-catalog/v1/" : "/api/am/service-catalog/v1/");
cookie.setHttpOnly(true);
cookie.setSecure(true);
cookie.setMaxAge((int) expiresIn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,17 @@ class ServiceCatalogClient {
* @returns {JSON} : Fixed specification
* @private
*/

_fixSpec(spec) {
const updatedSpec = spec;
updatedSpec.servers = [{ url: window.origin + '/api/am/service-catalog/v1' }];
if (Configurations.app.proxy_context_path && Configurations.app.proxy_context_path !== '') {
updatedSpec.servers = [{ url: window.origin + Configurations.app.proxy_context_path
+ '/api/am/service-catalog/v1' }];

} else {
updatedSpec.servers = [{ url: window.origin + '/api/am/service-catalog/v1' }];
}

return updatedSpec;
}

Expand Down
20 changes: 15 additions & 5 deletions portals/publisher/src/main/webapp/source/src/app/data/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,21 @@ class Utils {
* @memberof Utils
*/
static getServiceCatalogSwaggerURL() {
return (
'https://' +
Utils.getCurrentEnvironment().host +
Utils.CONST.SERVICE_CATALOG_SWAGGER_YAML
);
if (Configurations.app.proxy_context_path) {
return (
'https://' +
Utils.getCurrentEnvironment().host +
Configurations.app.proxy_context_path +
Utils.CONST.SERVICE_CATALOG_SWAGGER_YAML
);
} else {
return (
'https://' +
Utils.getCurrentEnvironment().host +
Utils.CONST.SERVICE_CATALOG_SWAGGER_YAML
);
}

// return Utils.CONST.SERVICE_CATALOG_SWAGGER_YAML;
}

Expand Down

0 comments on commit 7c14cd9

Please sign in to comment.