[ 
https://issues.apache.org/jira/browse/KNOX-3556?focusedWorklogId=1053469&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1053469
 ]

ASF GitHub Bot logged work on KNOX-3556:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Nov/26 09:47
            Start Date: 09/Nov/26 09:47
    Worklog Time Spent: 10m 
      Work Description: bonampak opened a new pull request, #1497:
URL: https://github.com/apache/knox/pull/1497

   [KNOX-3556](https://issues.apache.org/jira/browse/KNOX-3556) - A short 
description of the change
   
   ## What changes were proposed in this pull request?
   
   Add find mode to rewrite `<apply>` for HTML attributes and text.
   
   ## How was this patch tested?
   - Unit tests.
   - find defaults to false and no existing service definition uses it. 
UrlRewriteFilterApplyDescriptor interface was modified with default methods so 
legacy code does not break.
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1053469)
    Remaining Estimate: 0h
            Time Spent: 10m

> 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
>          Time Spent: 10m
>  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)

Reply via email to