Repository: ranger
Updated Branches:
  refs/heads/master 9b1ddbf3f -> 605691882


RANGER-1981: Error in constructing base path for UI API when accessing Ranger 
via knox proxy without "/" at the end

Signed-off-by: Mehul Parikh <me...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/60569188
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/60569188
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/60569188

Branch: refs/heads/master
Commit: 605691882e08771c96371715f52bc34380dd4d27
Parents: 9b1ddbf
Author: ni3galave <nitin.gal...@gmail.com>
Authored: Thu Feb 22 10:42:55 2018 +0530
Committer: Mehul Parikh <me...@apache.org>
Committed: Thu Feb 22 15:41:15 2018 +0530

----------------------------------------------------------------------
 security-admin/src/main/webapp/scripts/modules/RestCsrf.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/60569188/security-admin/src/main/webapp/scripts/modules/RestCsrf.js
----------------------------------------------------------------------
diff --git a/security-admin/src/main/webapp/scripts/modules/RestCsrf.js 
b/security-admin/src/main/webapp/scripts/modules/RestCsrf.js
index c201c72..50ac5f1 100644
--- a/security-admin/src/main/webapp/scripts/modules/RestCsrf.js
+++ b/security-admin/src/main/webapp/scripts/modules/RestCsrf.js
@@ -32,7 +32,11 @@ define(function(require) {
        if(!window.location.origin){
                window.location.origin = window.location.protocol + "//" + 
window.location.hostname + (window.location.port ? ':' + window.location.port: 
'');
        }
-       
+    // Proxy URL for Ranger UI doesn't work without trailing slash so add slash
+    var pathName = /\/[\w-]+.(jsp|html)/;
+    if(!pathName.test(window.location.pathname) && 
window.location.pathname.slice(-1) !== "/"){
+        history.pushState({}, null, window.location.pathname + "/");
+    }
        var baseUrl = window.location.origin + 
window.location.pathname.substr(0, window.location.pathname.lastIndexOf("/"));
        
        if(baseUrl.slice(-1) == "/") {

Reply via email to