[
https://issues.apache.org/jira/browse/KNOX-1866?focusedWorklogId=248240&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-248240
]
ASF GitHub Bot logged work on KNOX-1866:
----------------------------------------
Author: ASF GitHub Bot
Created on: 24/May/19 19:21
Start Date: 24/May/19 19:21
Worklog Time Spent: 10m
Work Description: joshelser commented on pull request #94: KNOX-1866 Fix
HBase UI proxying.
URL: https://github.com/apache/knox/pull/94#discussion_r287487420
##########
File path:
gateway-service-definitions/src/main/resources/services/hbaseui/2.1.0/rewrite.xml
##########
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ 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="HBASEUI/hbase/inbound/master/root"
pattern="*://*:*/**/hbase/webui/">
+ <!-- Visiting http://master-host:16010/ triggers a meta-refresh to
/master-status
+ which doesn't work when inside the proxy. Just avoid hitting that
endpoint. -->
+ <rewrite template="{$serviceUrl[HBASEUI]}/master-status"/>
+ </rule>
+ <rule dir="IN" name="HBASEUI/hbase/inbound/master/root/qualified"
pattern="*://*:*/**/hbase/webui/?{host}?port}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/master-status"/>
+ </rule>
+ <!-- Make sure that redirects back to the master landing page work -->
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/root" pattern="/">
+ <rewrite template="{gateway.url}/hbase/webui/"/>
+ </rule>
+ <!-- Generic pages on the default serviceUrl -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/master/home"
pattern="*://*:*/**//hbase/webui/master?{host}?{port}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/master-status"/>
+ </rule>
+ <rule dir="IN" name="HBASEUI/hbase/inbound/master/home"
pattern="*://*:*/**//hbase/webui/master?{host}?{port}?{**}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/master-status?{**} "/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/home"
pattern="//{host}:{port}/master-status?{**}">
+ <rewrite
template="{gateway.url}/hbase/webui/master/master-status?host={$hostmap(host)}?{port}?{**}"/>
+ </rule>
+
+ <!-- Load a RegionServer's status page -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/regionserver/home"
pattern="*://*:*/**//hbase/webui/regionserver?{host}?{port}">
+ <rewrite template="{$serviceScheme[HBASEUI]}://{host}:{port}/rs-status"/>
+ </rule>
+ <!-- Yes, we have both explicit and implicit scheme for rs-status outbound
links. Need these both -->
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/home"
pattern="*://{host}:{port}/rs-status/">
+ <rewrite
template="{gateway.url}/hbase/webui/regionserver/rs-status?host={$hostmap(host)}?{port}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/home"
pattern="//{host}:{port}/rs-status/">
+ <rewrite
template="{gateway.url}/hbase/webui/regionserver/rs-status?host={$hostmap(host)}?{port}"/>
+ </rule>
+
+ <!-- region.jsp -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/regions"
pattern="*://*:*/**/hbase/webui/regionserver/region.jsp?{host}?{port}?{name}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/region.jsp?{name}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regions"
pattern="/region.jsp?{name}?{**}">
+ <rewrite
template="{gateway.url}/hbase/webui/regionserver/region.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/regions"
pattern="//{host}:{port}/region.jsp?{name}">
+ <rewrite
template="{gateway.url}/hbase/webui/region.jsp?host={host}?{port}?{name}"/>
+ </rule>
+
+ <!-- storeFile.jsp -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/storefile"
pattern="*://*:*/**/hbase/webui/regionserver/storeFile.jsp?{host}?{port}?{name}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/storeFile.jsp?{name}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/storefile"
pattern="/storeFile.jsp?{name}">
+ <rewrite
template="{gateway.url}/hbase/webui/regionserver/storeFile.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{name}"/>
+ </rule>
+
+ <rule dir="IN" name="HBASEUI/hbase/inbound/processMaster"
pattern="*://*:*/**/hbase/webui/processMaster.jsp">
+ <rewrite template="{$serviceUrl[HBASEUI]}/processMaster.jsp"/>
+ </rule>
+
+ <!-- LogLevel servlet -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/loglevel"
pattern="*://*:*/**/hbase/webui/logLevel?{host}?{port}?{**}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/logLevel?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/loglevel"
pattern="/logLevel?{**}">
+ <rewrite
template="{gateway.url}/hbase/webui/logLevel?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+
+ <!-- Profiler servlet -->
+ <!-- prof-output sets the Refresh header to render the SVG after the
profiler finishes.
+ This sets up a filter to catch that Refresh header and rewrite it to
point to the
+ proxied location instead of the original.
+ -->
+ <filter name="HBASEUI/hbase/webui/outbound/headers/prof-output">
+ <content type="application/x-http-headers">
+ <apply path="Refresh"
rule="HBASEUI/hbase/webui/outbound/headers/prof-output/refresh"/>
+ </content>
+ </filter>
+ <rule dir="OUT"
name="HBASEUI/hbase/webui/outbound/headers/prof-output/refresh"
pattern="*;/prof-output/{**}?{**}">
+ <!-- Can we somehow parse the literal number to wait before redirect
instead of picking the constant 5s? -->
+ <rewrite
template="{$prefix[5;,url]}{gateway.url}/hbase/webui/master/prof-output/{**}?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+
+ <!-- zk.jsp on the Master page -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/zkdump"
pattern="*://*:*/**/hbase/webui/master/zk.jsp?{host}?{port}?{**}">
+ <rewrite template="{$servicScheme[HBASEUI]}://{host}:{port}/zk.jsp?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/webui/outbound/zkdump"
pattern="//{host}:{port}/zk.jsp?{**}">
+ <rewrite
template="{gateway.url}/hbase/webui/master/zk.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/webui/outbound/zkdump2"
pattern="/zk.jsp?{**}">
+ <rewrite
template="{gateway.url}/hbase/webui/master/zk.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+
+ <!-- table.jsp, the IN is handled by master/all_children -->
+ <rule dir="OUT" name="HBASEUI/table" pattern="/table.jsp?{name}">
+ <rewrite
template="{gateway.url}/hbase/webui/master/table.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{name}"/>
+ </rule>
+
+
+ <!-- WIP of master UI using query string to carry host and port -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/master/all_children"
pattern="*://*:*/**/hbase/webui/master/{**}?{host}?{port}?{**}">
+ <rewrite template="{$serviceScheme[HBASEUI]}://{host}:{port}/{**}?{**}"/>
+ </rule>
+ <rule dir="IN" name="HBASEUI/hbase/inbound/master/prof_output"
pattern="*://*:*//**/hbase/webui/master/prof-output/{**}?{host}?{port}">
+ <rewrite
template="{$serviceScheme[HBASEUI]}://{host}:{port}/prof-output/{**}?host={host}?port={port}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/master-status?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/master-status?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/conf?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/conf?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/tablesDetailed.jsp?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/tablesDetailed.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/procedures.jsp?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/procedures.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/processMaster.jsp?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/processMaster.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/dump?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/dump?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/jmx?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/jmx?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/master/children"
pattern="/prof?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/master/prof?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+
+ <!-- RegionServer UI proxying -->
+ <rule dir="IN" name="HBASEUI/hbase/inbound/regionserver/root/qualified"
pattern="*://*:*/**/hbase/webui/regionserver?{host}?port}">
+ <rewrite template="{$serviceScheme[HBASEUI]}://{host}:{port}/rs-status"/>
+ </rule>
+ <rule dir="IN" name="HBASEUI/hbase/inbound/regionserver/all_children"
pattern="*://*:*/**/hbase/webui/regionserver/{**}?{host}?{port}?{**}">
+ <rewrite template="{$serviceScheme[HBASEUI]}://{host}:{port}/{**}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/children"
pattern="/rs-status?{**}">
+ <rewrite
template="{$frontend[url]}/hbase/webui/regionserver/rs-status?host={$inboundurl[host]}?port={$inboundurl[port]}?{**}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/children"
pattern="/processRS.jsp">
+ <rewrite
template="{$frontend[url]}/hbase/webui/regionserver/processRS.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/children"
pattern="/conf">
+ <rewrite
template="{$frontend[url]}/hbase/webui/regionserver/conf?host={$inboundurl[host]}?port={$inboundurl[port]}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/children"
pattern="/tablesDetailed.jsp">
+ <rewrite
template="{$frontend[url]}/hbase/webui/regionserver/tablesDetailed.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/children"
pattern="/procedures.jsp">
+ <rewrite
template="{$frontend[url]}/hbase/webui/regionserver/procedures.jsp?host={$inboundurl[host]}?port={$inboundurl[port]}"/>
+ </rule>
+ <rule dir="OUT" name="HBASEUI/hbase/outbound/regionserver/children"
pattern="/dump">
Review comment:
> So /conf, /dump, /jmx, and /prof (there might be others) all match both
the regionserver and master handling. The redirect urls are written from a RS
url back to a master url. It looks like the right data (since the host/port) is
on the end - so it might make sense to make these rules not master/regionserver
specific?
Yeah, these should just be non-specific to regionserver/master at this
point. Pretty sure there aren't problems in practice (will double-check) but
duplicity will be confusing (in a time where I'm trying to make this less
confusing).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 248240)
Time Spent: 1h 10m (was: 1h)
> Fix the HBase UI proxying
> -------------------------
>
> Key: KNOX-1866
> URL: https://issues.apache.org/jira/browse/KNOX-1866
> Project: Apache Knox
> Issue Type: Bug
> Reporter: Josh Elser
> Assignee: Josh Elser
> Priority: Major
> Fix For: 1.3.0
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> There are lots and lots of edges in the HBASEUI service which render the
> system broken.
> I've been able to get everythign working exception the LogLevel servlet. The
> way this one is written in HBase fundamentally makes it impossible to proxy
> it as-is with Knox (at least, given my knowledge).
> There are some trivial HBase changes that need to go in first to make sure
> these rules work as expected.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)