Repository: incubator-zeppelin Updated Branches: refs/heads/master 9f4c66511 -> f04ce390f
ZEPPELIN-31 fix REST API base path in web-app Fixes https://issues.apache.org/jira/browse/ZEPPELIN-31 Author: Alexander Bezzubov <[email protected]> Author: Alexander Bezzubov <[email protected]> Closes #30 from bzz/fix-rest-api-path-in-webapp and squashes the following commits: ace385b [Alexander Bezzubov] ZEPPELIN-31: fixing case of the root pathname 50cf350 [Alexander Bezzubov] Merge branch 'master' into fix-rest-api-path-in-webapp 5c8bdef [Alexander Bezzubov] ZEPPELIN-31 add relative location.pathname to REST API base path Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/f04ce390 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/f04ce390 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/f04ce390 Branch: refs/heads/master Commit: f04ce390f5ed8f857f8d94ce5d33beb7283209c9 Parents: 9f4c665 Author: Alexander Bezzubov <[email protected]> Authored: Sun May 10 18:33:58 2015 +0900 Committer: Alexander Bezzubov <[email protected]> Committed: Fri Jun 12 18:32:37 2015 +0900 ---------------------------------------------------------------------- zeppelin-web/app/scripts/app.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/f04ce390/zeppelin-web/app/scripts/app.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/app/scripts/app.js b/zeppelin-web/app/scripts/app.js index ff55647..64a1292 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+"/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; } /**
