[
https://issues.apache.org/jira/browse/KNOX-3556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tamás Marcinkovics resolved KNOX-3556.
--------------------------------------
Fix Version/s: 3.1.0
Resolution: Fixed
> Rewrite: add find option to apply so URLs embedded in HTML attribute values
> and style text can be rewritten
> -----------------------------------------------------------------------------------------------------------
>
> Key: KNOX-3556
> URL: https://issues.apache.org/jira/browse/KNOX-3556
> Project: Apache Knox
> Issue Type: Task
> Components: Server
> Affects Versions: 3.0.0
> Reporter: Tamás Marcinkovics
> Assignee: Tamás Marcinkovics
> Priority: Major
> Fix For: 3.1.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Add find mode to rewrite {{<apply>}} for HTML attributes and text.
>
> OpenSearch Dashboards puts its base path into the page as
> {{{}<osd-injected-metadata
> data="\{"basePath":"/ctx","serverBasePath":"/ctx",…}">{}}}.
> The browser JS reads this once at startup and builds every request URL and
> the router base from it, so the value must include the Knox prefix
> ({{{}/gateway/<topology>/ctx{}}}).
>
> Knox rewrites an attribute only when its whole value is a URL, so a URL
> embedded in a JSON attribute value is left unchanged.
> Because Knox cannot rewrite inside the attribute, the backend has to be
> configured with the gateway path and topology name. In that page only four
> values need rewriting: basePath, serverBasePath, i18n.translationsUrl and
> branding.assetFolderUrl.
> About 100 font URLs in inline {{<style>}} are affected the same way.
> h4. Proposal
> Add an optional find attribute to <apply> (default false, so existing service
> definitions are unaffected):
> {{<content type="*/html">}}
> {{<apply path="/ctx[^&"'\s\\)]*" find="true" rule="..."/>}}
> {{</content>}}
> When it is set, the HTML reader applies the regex with {{Matcher.find()}} to
> attribute values and to {{<style>}} text. It rewrites each match through the
> named rule and leaves the surrounding text untouched. This is the behaviour
> the reader already has for {{<script>}} text.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)