Skip to content

Commit ed3f76e

Browse files
Raghuveer RaaviRaghuveer Raavi
andauthored
Switch from hardcoded "https" protocol (#4990)
Co-authored-by: Raghuveer Raavi <raghuveer.raavi@ibm.com>
1 parent fb3220c commit ed3f76e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

core/routemgmt/common/apigw-utils.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,13 @@ function getCaseOperationIdx(caseArr, operationId) {
600600
// Returns:
601601
// string - web-action URL
602602
function makeWebActionBackendUrl(endpointAction, endpointResponseType, isTargetUrl = false) {
603+
protocol = getProtocolFromActionUrl(endpointAction.backendUrl);
603604
host = getHostFromActionUrl(endpointAction.backendUrl);
604605
ns = endpointAction.namespace;
605606
pkg = getPackageNameFromFqActionName(endpointAction.name) || 'default';
606607
name = getActionNameFromFqActionName(endpointAction.name);
607608
reqPath = isTargetUrl && endpointResponseType === 'http' ? "$(request.path)" : "";
608-
return 'https://' + host + '/api/v1/web/' + ns + '/' + pkg + '/' + name + '.' + endpointResponseType + reqPath;
609+
return protocol + '://' + host + '/api/v1/web/' + ns + '/' + pkg + '/' + name + '.' + endpointResponseType + reqPath;
609610
}
610611

611612
/*
@@ -775,6 +776,14 @@ function getHostFromActionUrl(actionUrl) {
775776
return parseActionUrl(actionUrl)[2];
776777
}
777778

779+
/*
780+
* https://172.17.0.1/api/v1/namespaces/whisk.system/actions/getaction
781+
* would return https
782+
*/
783+
function getProtocolFromActionUrl(actionUrl) {
784+
return parseActionUrl(actionUrl)[1];
785+
}
786+
778787
/*
779788
* Parses an openwhisk action name into its various components
780789
* Parameters

0 commit comments

Comments
 (0)