This is an automated email from the ASF dual-hosted git repository.

more pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new e04d429  KNOX-1862 - Add Service Definition for Hue UI (#97)
e04d429 is described below

commit e04d429fe36173ab42b570b6ad4108fdc563f071
Author: jdesjean <[email protected]>
AuthorDate: Wed Jun 19 13:48:58 2019 -0700

    KNOX-1862 - Add Service Definition for Hue UI (#97)
---
 .../main/resources/services/hue/1.0.0/rewrite.xml  | 134 +++++++++++++++++++++
 .../main/resources/services/hue/1.0.0/service.xml  |  58 +++++++++
 2 files changed, 192 insertions(+)

diff --git 
a/gateway-service-definitions/src/main/resources/services/hue/1.0.0/rewrite.xml 
b/gateway-service-definitions/src/main/resources/services/hue/1.0.0/rewrite.xml
new file mode 100644
index 0000000..f725612
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/hue/1.0.0/rewrite.xml
@@ -0,0 +1,134 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<rules>
+  <rule dir="IN" name="HUE/hue/inbound/huerule" flow="OR">
+    <!-- We have exceptions for dashboard/hbase/notebook, because endpoint 
that ends at the app/lib level need to terminate with a slash and we remove 
them in generic case. -->
+    <!-- Other solution would be to accept trailing slash on all endpoints, 
but there's some issue with the filebrowser -->
+    <match pattern="*://*:*/**/hue/hue/dashboard?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/hue/dashboard/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/dashboard?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/dashboard/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/hue/hbase?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/hue/hbase/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/hbase?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/hbase/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/hue/jobbrowser?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/hue/jobbrowser/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/jobbrowser?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/jobbrowser/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/hue/notebook?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/hue/notebook/?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/notebook?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/notebook/?{**}"/>
+    </match>
+    <!-- We have exceptions for static because it can have hue or static 
further in the URL and KNOX matches the last one with **, but we want to match 
the first one. -->
+    <match pattern="*://*:*/**/hue/static/{**}?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/static/{**}?{**}"/>
+    </match>
+    <!-- The rest: Generic case -->
+    <match pattern="*://*:*/**/hue/hue/{**}?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/hue/{**}?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/{**}?{**}">
+      <rewrite template="{$serviceUrl[HUE]}/{**}?{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/{**}">
+      <rewrite template="{$serviceUrl[HUE]}/{**}"/>
+    </match>
+    <match pattern="*://*:*/**/hue/">
+      <rewrite template="{$serviceUrl[HUE]}/"/>
+    </match>
+ </rule>
+
+  <rule dir="OUT" name="HUE/hue/outbound/huerooturl/desktop" flow="OR">
+    <match pattern="/desktop/{**}?{**}" >
+       <rewrite template="{$frontend[path]}/hue/desktop/{**}?{**}"/>
+    </match>
+  </rule>
+  <rule dir="OUT" name="HUE/hue/outbound/huerooturl/static" flow="OR">
+    <match pattern="/static/{**}?{**}">
+       <rewrite template="{$frontend[path]}/hue/static/{**}?{**}"/>
+    </match>
+  </rule>
+  <rule dir="OUT" name="HUE/hue/outbound/huerooturl/css" 
pattern="/static/{*}/{**}?{**}">
+    <rewrite template="{$frontend[path]}/hue/static/{*}/{**}?{**}"/>
+  </rule>
+  <rule dir="OUT" name="HUE/hue/outbound/huerooturl/root" pattern="/boohoo">
+    <rewrite template="{$frontend[path]}/hue/boohoo"/>
+  </rule>
+  <filter name="HUE/hue/outbound/huerooturl">
+    <content type="*/html">
+        <apply path="/desktop/globalJsConstants.*" 
rule="HUE/hue/outbound/huerooturl/desktop"/>
+        <apply path="/boohoo" rule="HUE/hue/outbound/huerooturl/root"/>
+        <apply path="\/static\/.*\/.*\.(js|css|html|png)" 
rule="HUE/hue/outbound/huerooturl/static"/>
+        <apply path="\/static\/desktop\/js\/ace" 
rule="HUE/hue/outbound/huerooturl/static"/>
+    </content>
+    <content type="*/css">
+        <apply path="\/static\/.*\/.*\.(js|css|html|png)" 
rule="HUE/hue/outbound/huerooturl/static"/>
+    </content>
+  </filter>
+
+  <filter name="HUE/hue/outbound/workers">
+    <content type="*/javascript">
+        <apply path="\/static\/.*\/.*\.(js|css|html|png)" 
rule="HUE/hue/outbound/huerooturl/static"/>
+    </content>
+  </filter>
+
+  <rule dir="OUT" name="HUE/hue/outbound/global/base/hue" flow="OR">
+    <match pattern="/KNOX_BASE_PATH_HUE" >
+       <rewrite template="{$frontend[path]}/hue"/>
+    </match>
+  </rule>
+  <rule dir="OUT" name="HUE/hue/outbound/global/base/knox" flow="OR">
+    <match pattern="/KNOX_BASE_URL" >
+       <rewrite template="{$frontend[url]}"/>
+    </match>
+  </rule>
+  <filter name="HUE/hue/outbound/global">
+    <content type="*/javascript">
+        <apply path="/KNOX_BASE_PATH_HUE" 
rule="HUE/hue/outbound/global/base/hue"/>
+        <apply path="/KNOX_BASE_URL" rule="HUE/hue/outbound/global/base/knox"/>
+    </content>
+  </filter>
+
+  <rule dir="OUT" name="HUE/hue/outbound/headers/location" flow="OR">
+    <match pattern="/hue/{**}?{**}">
+      <rewrite template="{$frontend[path]}/hue/hue/{**}?{**}"/>
+    </match>
+    <match pattern="/hue">
+      <rewrite template="{$frontend[path]}/hue/hue"/>
+    </match>
+    <match pattern="/{**}?{**}">
+      <rewrite template="{$frontend[path]}/hue/{**}?{**}"/>
+    </match>
+    <match pattern="/">
+      <rewrite template="{$frontend[path]}/hue/"/>
+    </match>
+  </rule>
+  <filter name="HUE/hue/outbound/headers">
+    <content type="application/x-http-headers">
+       <apply path="Location" rule="HUE/hue/outbound/headers/location"/>
+    </content>
+  </filter>
+</rules>
\ No newline at end of file
diff --git 
a/gateway-service-definitions/src/main/resources/services/hue/1.0.0/service.xml 
b/gateway-service-definitions/src/main/resources/services/hue/1.0.0/service.xml
new file mode 100644
index 0000000..7694feb
--- /dev/null
+++ 
b/gateway-service-definitions/src/main/resources/services/hue/1.0.0/service.xml
@@ -0,0 +1,58 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<service role="HUE" name="hue" version="1.0.0">
+  <routes>
+    <!-- Since we don't have to rewrite URLs for all javascript, we single out 
these 2 exceptions: 1 for workers & the other for the base URL -->
+    <route path="/hue/desktop/workers/{**}?{**}">
+      <rewrite apply="HUE/hue/inbound/huerule" to="request.url"/>
+      <rewrite apply="HUE/hue/outbound/headers" to="response.headers"/>
+      <rewrite apply="HUE/hue/outbound/workers" to="response.body"/>
+    </route>
+    <route path="/hue/desktop/globalJsConstants.js?{**}">
+      <rewrite apply="HUE/hue/inbound/huerule" to="request.url"/>
+      <rewrite apply="HUE/hue/outbound/headers" to="response.headers"/>
+      <rewrite apply="HUE/hue/outbound/global" to="response.body"/>
+    </route>
+    <!-- All URLs except above exceptions -->
+    <route path="/hue/**">
+      <rewrite apply="HUE/hue/inbound/huerule" to="request.url"/>
+      <rewrite apply="HUE/hue/outbound/headers" to="response.headers"/>
+      <rewrite apply="HUE/hue/outbound/huerooturl" to="response.body"/>
+    </route>
+    <route path="/hue/">
+      <rewrite apply="HUE/hue/inbound/huerule" to="request.url"/>
+      <rewrite apply="HUE/hue/outbound/headers" to="response.headers"/>
+      <rewrite apply="HUE/hue/outbound/huerooturl" to="response.body"/>
+    </route>
+    <route path="/hue/**?**">
+      <rewrite apply="HUE/hue/inbound/huerule" to="request.url"/>
+      <rewrite apply="HUE/hue/outbound/headers" to="response.headers"/>
+      <rewrite apply="HUE/hue/outbound/huerooturl" to="response.body"/>
+    </route>
+    <route path="/hue/?**">
+      <rewrite apply="HUE/hue/inbound/huerule" to="request.url"/>
+      <rewrite apply="HUE/hue/outbound/headers" to="response.headers"/>
+      <rewrite apply="HUE/hue/outbound/huerooturl" to="response.body"/>
+    </route>
+  </routes>
+  <dispatch classname="org.apache.knox.gateway.dispatch.ConfigurableDispatch" 
ha-classname="org.apache.knox.gateway.dispatch.ConfigurableDispatch">
+    <param>
+      <name>responseExcludeHeaders</name>
+      <value>WWW-AUTHENTICATE</value>
+    </param>
+  </dispatch>
+</service>
\ No newline at end of file

Reply via email to