[ https://issues.apache.org/jira/browse/KNOX-618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217037#comment-15217037 ]
Jeffrey Rodriguez commented on KNOX-618: ---------------------------------------- Thanks Kevin. The issue manifest in the case of pages in a cluster like Yarn Resource Manager UI: http://myrm.com:8088, this page contains links to Yarn Node Managers: http://mynm1.com:8042, http://mynm2.com, http://mynm3.com. The Resource Manager page has links to the Node Managers. We defined two roles RMUI service: <service> <role>RMUI</r> <url>http://myrm.com:8088</url> </service> <service> <role>NMUI</r> <url>http://mynm1.com:8042</url> </service> 1. During RM UI page output In the page we may have content like embedded script with href= http://mynm2.com:8042 We want to be able to rewrite href=http://mynm2.com:8042 to https://knoxhost:knoxport/gateway/rmui/rm?{host=mynm2.com}?{port=8042 2. When we click https://knoxhost:knoxport/gateway/rmui/rm?{host=mynm2.com}?{port=8042} we apply an IN rewrite rule to access http://mynm2.com:8042. 3. The issue is that on the response to 2, we need to rewrite the href content with the same method we apply in 2., add query params rm?{host= mynm2.com}?{port=8042} e.g. mynm2.com web page href="/logs" we want to apply a rule to include service Host header (Header = mynm2.com ) so href will end up as /logs??{host= mynm2.com}?{port=8042} Then when we user clicks that link it will be rewritten to http://mynm2.com:8042/logs Unfortunately $serviceUrl[NODEUI] would not work since it would have the wrong NMUI host: http://mynm1.com:8042 So something like this would help <rule dir="OUT" name="NMUI/logs" pattern="/logs/{**}"> <rewrite template="{$frontend[url]}/node/logs/{**}?host={$header[host]}?port=???"/> </rule> So I think that KNOX-618 may work for me. I can give a try to the parch you just posted. The other issue I want to discuss is the fact that the some of the user interfaces usually refer to more than one server like in the case of Yarn Resurce manager (refers to nodemanagers). and HBase Master UI (refers also to region servers). Even though I could have created more than one role like : <service> <role>NMUI1</r> <url>http://mynm1.com:8042</url> </service> <service> <role>NMUI2</r> <url>http://mynm2.com:8042</url> </service> <service> <role>NMUI3</r> <url>http://mynm3.com:8042</url> </service> The issue is that during output rewrite there is very little I can do since the information of the namenode hosts is already hardwired by the Yarn RM UI. There has to be a better way to deal with proxying to a Server which refers to other servers. Regards, Jeff Rodriguez On Tue, Mar 29, 2016 at 2:43 PM, Kevin Minder (JIRA) <j...@apache.org> > Rewrite function for accessing header values > -------------------------------------------- > > Key: KNOX-618 > URL: https://issues.apache.org/jira/browse/KNOX-618 > Project: Apache Knox > Issue Type: New Feature > Components: Server > Affects Versions: 0.6.0 > Reporter: Kevin Minder > Assignee: Kevin Minder > Priority: Minor > Fix For: Future > > Attachments: KNOX-618_001.patch > > > I recently ran into a situation where it would have been useful to have > access to header values in the rewrite rules. In particular it would be > useful sometimes to API version with a header like this. > {code} > <match pattern="{scheme}://{host}:{port}/api/{path=**}?{**}"> > <rewrite > template=""{scheme}://{host}:{port}/api/{$header[version]}/{path}?{**}""/> > </match> > {code} > As implied above the rewrite function plugin model seems like an excellent > way to provide basic access to header information. -- This message was sent by Atlassian JIRA (v6.3.4#6332)