I’m hoping that Yu will chime in here given the recent work in this area. I
see the HTML filtering in
gateway-service-definitions/src/main/resources/services/yarnui/2.7.0/rewrite.xml
which I was assuming would facilitate what you want but it looks like it may
only apply to embedded JavaScript.
<filter name="YARNUI/yarn/outbound/apps">
<content type="*/html">
<apply path="https?://[^/':,]+:[\d]+/proxy/[^']*"
rule="YARNUI/yarn/outbound/apps/history"/>
<apply path="//[^/':,]+:[\d]+/node/containerlogs/container[^']*"
rule="YARNUI/yarn/outbound/node/containerlogs"/>
<apply path="(https?://[^/':,]+:[\d]+)?/cluster/app"
rule="YARNUI/yarn/outbound/apps/app"/>
<apply path="/cluster/container"
rule="YARNUI/yarn/outbound/cluster/container"/>
</content>
</filter>
So the bottom line is that I think some additional work might still be required
in this area and it should probably follow Yu’s lead. I do see an opportunity
here now for something potentially a bit more generic that might be able to
encompass both use cases. Something like
<apply-regex path=“{xpath}” regex=“{regex}” rule=“{rule}”/>
Where the rule would be applied to say group(1) of the regex. Might even be
able to build that into the normal <apply/> with an implied regex=“.*”.
From: Jeffrey Rodriguez
Reply-To: "[email protected]<mailto:[email protected]>"
Date: Monday, July 27, 2015 at 8:38 PM
To: "[email protected]<mailto:[email protected]>"
Subject: Using outbound rewrite patterns in html meta refrex
Have a question on how to rewrite outbound html meta refresh.
e.g.
Let say I want to change:
<meta http-equiv="refresh" content="0; url=http://service">
into
<meta http-equiv="refresh" content="0;
url=http://knox_host:knox_port/gateway/default/service">
So I can route page through Knox.
I can match the entire "0; url=http://service" with a rule dir="OUT" but I
don't have control on
how to parse the refresh time form the url.
But I would like to figure out a way so I get the refresh time.
Does Knox support regex rule patterns on rule/rewrite template?
If it does then I could use something like (\d);\s*(.*) to capture the refresh
time in the rule and use
it in the rewrite template.
Thanks,
Jeffrey Rodriguez