Repository: knox Updated Branches: refs/heads/master 11539a2e3 -> f8909f52a
KNOX-1365 - Handle index.html redirection in YARNUI v2 (Sunil Govindan via Sandeep More) Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/f8909f52 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/f8909f52 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/f8909f52 Branch: refs/heads/master Commit: f8909f52a3b17773f139b4bca0a4bb4380241d5e Parents: 11539a2 Author: Sandeep More <[email protected]> Authored: Fri Jun 29 18:01:42 2018 -0400 Committer: Sandeep More <[email protected]> Committed: Fri Jun 29 18:01:42 2018 -0400 ---------------------------------------------------------------------- .../services/yarnuiv2/3.0.0/rewrite.xml | 22 ++++++++++++++++++-- .../services/yarnuiv2/3.0.0/service.xml | 11 +++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/f8909f52/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml ---------------------------------------------------------------------- diff --git a/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml index 073d54a..4b985e1 100644 --- a/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml +++ b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/rewrite.xml @@ -21,12 +21,16 @@ <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}&{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}&{port=**}?{**}"> - <rewrite template="http://{host}:{port=**}?{**}"/> + <rewrite template="{$serviceScheme[YARNUIV2]}://{host}:{port=**}?{**}"/> </rule> <rule dir="IN" name="YARNUIV2/yarnuiv2/inbound/logs" pattern="*://*:*/**/yarnuiv2/logs/?{**}"> @@ -152,5 +156,19 @@ </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> http://git-wip-us.apache.org/repos/asf/knox/blob/f8909f52/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml ---------------------------------------------------------------------- diff --git a/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml index 1fb1d21..2c1ba59 100644 --- a/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml +++ b/gateway-service-definitions/src/main/resources/services/yarnuiv2/3.0.0/service.xml @@ -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/?**"> @@ -37,11 +38,15 @@ <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>
