From 5c8bdeff71aaea1a2c8cbba90e7ded78a5a26ef9 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Tue, 7 Apr 2015 18:00:37 +0900 Subject: [PATCH 1/2] ZEPPELIN-31 add relative location.pathname to REST API base path --- zeppelin-web/app/scripts/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeppelin-web/app/scripts/app.js b/zeppelin-web/app/scripts/app.js index ff55647b4e5..620b714ec50 100644 --- a/zeppelin-web/app/scripts/app.js +++ b/zeppelin-web/app/scripts/app.js @@ -62,7 +62,7 @@ function getRestApiBase() { if (port === 3333 || port === 9000) { port = 8080; } - return location.protocol+"//"+location.hostname+":"+port+"/api"; + return location.protocol+"//"+location.hostname+":"+port + location.pathname + "/api"; } /** From ace385ba9af6cf697f8a7920c1f8eb0b83f5d963 Mon Sep 17 00:00:00 2001 From: Alexander Bezzubov Date: Sun, 10 May 2015 18:33:58 +0900 Subject: [PATCH 2/2] ZEPPELIN-31: fixing case of the root pathname --- zeppelin-web/app/scripts/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zeppelin-web/app/scripts/app.js b/zeppelin-web/app/scripts/app.js index 620b714ec50..64a1292819b 100644 --- a/zeppelin-web/app/scripts/app.js +++ b/zeppelin-web/app/scripts/app.js @@ -62,7 +62,11 @@ function getRestApiBase() { if (port === 3333 || port === 9000) { port = 8080; } - return location.protocol+"//"+location.hostname+":"+port + location.pathname + "/api"; + return location.protocol+"//"+location.hostname+":"+port + skipTrailingSlash(location.pathname) + "/api"; +} + +function skipTrailingSlash(path) { + return path.slice(-1) === "/" ? path.substring(0, path.length-1) : path; } /**