You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2018/02/11 17:40:41 UTC
[incubator-openwhisk] branch master updated: Allow / in "host"
portion of actionUrlPattern (#3125)
This is an automated email from the ASF dual-hosted git repository.
csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 64e4639 Allow / in "host" portion of actionUrlPattern (#3125)
64e4639 is described below
commit 64e463940cbc0001a46a4a79ebd56d2414f6925d
Author: David Grove <dg...@users.noreply.github.com>
AuthorDate: Sun Feb 11 12:40:37 2018 -0500
Allow / in "host" portion of actionUrlPattern (#3125)
* Allow / in "host" portion of actionUrlPattern
Allowing / in the "host" portion of the actionUrlPattern supports
deployments where URL rewriting in a front-end proxy is used to allow
multiple services to be hosted from a single hostname or IP address.
This is a common scenario for Kubernetes-based deployments where a
cluster may only have a single exposed IP address or DNS name and its
Ingress does URL rewriting to expose multiple services using different
paths. For example, when deploying OpenWhisk on a kube cluster we
need to expose two aspects of OpenWhisk using a single host name
mycluster.cloudprovider.com/openwhisk
mycluster.cloudprovider.com/apigateway
* review comment: escape / in regex string
---
core/routemgmt/common/apigw-utils.js | 4 ++--
core/routemgmt/common/utils.js | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/core/routemgmt/common/apigw-utils.js b/core/routemgmt/common/apigw-utils.js
index cb605ca..07f2be5 100644
--- a/core/routemgmt/common/apigw-utils.js
+++ b/core/routemgmt/common/apigw-utils.js
@@ -721,7 +721,7 @@ function generateCliApiFromGwApi(gwApi) {
* result - an array of strings.
* result[0] : Entire URL
* result[1] : protocol (i.e. https)
- * result[2] : host (i.e. myco.com, 1.2.3.4)
+ * result[2] : host (i.e. myco.com, 1.2.3.4, myco.com/mywhisk)
* result[3] : namespace
* result[4] : package name
* result[5] : action name
@@ -729,7 +729,7 @@ function generateCliApiFromGwApi(gwApi) {
*/
function parseActionUrl(actionUrl) {
console.log('parseActionUrl: parsing action url: '+actionUrl);
- var actionUrlPattern = /(\w+):\/\/([:\w.\-]+)\/api\/v\d\/web\/([@\w .\-]+)\/([@\w .\-]+)\/([@\w .\-\/]+)\.(\w+)/;
+ var actionUrlPattern = /(\w+):\/\/([:\/\w.\-]+)\/api\/v\d\/web\/([@\w .\-]+)\/([@\w .\-]+)\/([@\w .\-\/]+)\.(\w+)/;
try {
return actionUrl.match(actionUrlPattern);
} catch(e) {
diff --git a/core/routemgmt/common/utils.js b/core/routemgmt/common/utils.js
index 6e3c3a7..a9672b9 100644
--- a/core/routemgmt/common/utils.js
+++ b/core/routemgmt/common/utils.js
@@ -687,12 +687,12 @@ function generateCliApiFromGwApi(gwApi) {
* result - an array of strings.
* result[0] : Entire URL
* result[1] : protocol (i.e. https)
- * result[2] : host (i.e. myco.com, 1.2.3.4)
+ * result[2] : host (i.e. myco.com, 1.2.3.4, myco.com/whisk)
* result[3] : namespace
* result[4] : action name, including the package if used (i.e. myaction, mypkg/myaction)
*/
function parseActionUrl(actionUrl) {
- var actionUrlPattern = /(\w+):\/\/([:\w.\-]+)\/api\/v\d\/namespaces\/([@\w .\-]+)\/actions\/([@\w .\-\/]+)/;
+ var actionUrlPattern = /(\w+):\/\/([:\/\w.\-]+)\/api\/v\d\/namespaces\/([@\w .\-]+)\/actions\/([@\w .\-\/]+)/;
try {
return actionUrl.match(actionUrlPattern);
} catch(e) {
--
To stop receiving notification emails like this one, please contact
csantanapr@apache.org.