KNOX-1365 - Handle index.html redirection in YARNUI v2 (Sunil Govindan via Sandeep...
authorSandeep More <more@apache.org>
Fri, 29 Jun 2018 22:01:42 +0000 (18:01 -0400)
committerSandeep More <more@apache.org>
Fri, 29 Jun 2018 22:01:42 +0000 (18:01 -0400)
gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml
gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml

index 073d54a..4b985e1 100644 (file)
     <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/"/>
   </rule>
 
+  <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/redirect" pattern="*://*:*/**/yarnuiv2/redirect">
+    <rewrite template="{$serviceUrl[YARNUIV2]}/ui2/index.html"/>
+  </rule> 
   <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/node" pattern="*://*:*/**/yarnuiv2/node?{host}&amp;{port=**}">
-    <rewrite template="http://{host}:{port=**}"/>
+    <rewrite template="{$serviceScheme[YARNUIV2]}://{host}:{port=**}"/>
   </rule> 
  
   <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/timeline" pattern="*://*:*/**/yarnuiv2/timeline?{host}&amp;{port=**}?{**}">
-    <rewrite template="http://{host}:{port=**}?{**}"/>
+    <rewrite template="{$serviceScheme[YARNUIV2]}://{host}:{port=**}?{**}"/>
   </rule> 
  
   <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/logs" pattern="*://*:*/**/yarnuiv2/logs/?{**}">
     </content>
   </filter>
 
+  <rule flow="OR" dir="OUT" name="YARNUIV2/yarnuiv2/outbound/headers/index/location">
+    <match pattern="{scheme}://{host}:{port}/{gateway}/{knoxsso}/{api}/{v}/websso?originalUrl={**}">
+      <rewrite template="{scheme}://{host}:{port}/{gateway}/{knoxsso}/{api}/{v}/websso?originalUrl={$postfix[url,/yarnuiv2/]}"/>
+    </match>
+    <match pattern="{scheme}://{host}:{port}/ui2/index.html">
+      <rewrite template="{$frontend[url]}/yarnuiv2/redirect"/>
+    </match>
+  </rule>
+
+  <filter name="YARNUIV2/yarnuiv2/outbound/headers/location">
+    <content type="application/x-http-headers">
+      <apply path="Location" rule="YARNUIV2/yarnuiv2/outbound/headers/index/location"/>
+    </content>
+  </filter>
  </rules>
   
index 1fb1d21..2c1ba59 100644 (file)
@@ -25,6 +25,7 @@
   <routes>
     <route path="/yarnuiv2">
       <rewrite apply="YARNUIV2/yarnuiv2/inbound/rootAppScript" to="request.url"/>
+      <rewrite apply="YARNUIV2/yarnuiv2/outbound/headers/location" to="response.headers"/>
     </route>
 
     <route path="/yarnuiv2/logs/?**">
  
     <route path="/yarnuiv2/node?**">
       <rewrite apply="YARNUIV2/yarnuiv2/inbound/node" to="request.url"/>
-    </route>  
+    </route>
 
     <route path="/yarnuiv2/timeline?**">
       <rewrite apply="YARNUIV2/yarnuiv2/inbound/timeline" to="request.url"/>
-    </route>  
+    </route>
+
+    <route path="/yarnuiv2/redirect">
+      <rewrite apply="YARNUIV2/yarnuiv2/inbound/redirect" to="request.url"/>
+    </route>
 
     <route path="/yarnuiv2/**?**">
       <rewrite apply="YARNUIV2/yarnuiv2/inbound/query" to="request.url"/>
@@ -89,7 +94,7 @@
     <route path="/yarnuiv2/config/**">
       <rewrite apply="YARNUIV2/yarnuiv2/inbound/config" to="request.url"/>
     </route>
-    
+
   </routes>
   <dispatch classname="org.apache.knox.gateway.dispatch.PassAllHeadersDispatch" ha-classname="org.apache.knox.gateway.rm.dispatch.RMUI2HaDispatch"/>
 </service>