Well maybe.  Sounds like what you are sort of asking for is this.
https://issues.apache.org/jira/browse/KNOX-618

However if I'm understanding you correctly what you probably want is one of two 
other things.  I'm guessing you want #1.

(1)  <rewrite template="{$frontend[url]}/node/logs/{**}"/>
This will result in something like 
https://my-knox-host:8443/gateway/sandbox/node/logs/some-path

(2) <rewrite template="{$serviceUrl[NODEUI]}/api/{path=**}?{**}"/>
This will result in something like 
http://my-node-ui-host:8080/api/some-path?some-query
The value of $serviceUrl[NODEUI] is the value of the <url> element for the 
<service> with <role>NODEUI</role>.

In addition, the $frontend function supports addr, scheme, host, port, and path 
in addition to url.
$frontend[addr] == my-knox-host:8443
$frontend[scheme] == https
$frontend[host] == my-knox-host
$frontend[port] = 8443
$frontend[path] = /gateway/sandbox


From: Jeffrey Rodriguez <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, March 29, 2016 at 5:09 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Any function that we can use in a rewrite rule which uses the host 
header info from service?

Sorry sent to wrong list before.

Here is my question.

Do we have a Knox rewrite function that we can use in a "rewrite rule" that 
uses the host header info from service?

I would like to rewrite the service output.

For example if I have the following rule which as a request into a yarn name 
manager web UI has:

<rule dir="OUT" name="NODEUI/logfiles" pattern="/logs/{**}">
    <rewrite template="{$servicehost}/node/logs/{**}"/>
</rule>

Since the dispatcher has access to the Host request header, a $servicehost 
function could capture this information so we can rewrite output to to the 
correct Yarn namenode manager web host and port.

$servicehost is a variable which has information only valid to the transaction 
(request/response).


Regards,
              Jeff Rodriguez




Reply via email to