Ho yes !! I'm currently defining a Dispatch class for that.
It's much simpler with the use of rewrite.xml.
Thanks a lot Sandeep

David

Le sam. 28 juil. 2018 à 19:55, Sandeep Moré <[email protected]> a
écrit :

> David,
>
> You can rewrite the location header, there are a bunch of services that
> rewrite the location header.
>
> e.g.
>
> <filter name="SPARKHISTORYUI/sparkhistory/outbound/headers/jobs">
>   <content type="application/x-http-headers">
>     <apply path="Location" 
> rule="SPARKHISTORYUI/sparkhistory/outbound/headers/jobs/location"/>
>   </content>
> </filter>
>
> <rule dir="OUT" 
> name="SPARKHISTORYUI/sparkhistory/outbound/headers/jobs/location">
>   <match pattern="*://*:*/history/{**}/jobs">
>     <rewrite template="{$frontend[url]}/sparkhistory/history/{**}/jobs"/>
>   </match>
> </rule>
>
>
>
> On Sat, Jul 28, 2018 at 10:55 AM David Morin <[email protected]>
> wrote:
>
>> yes, this is a request going in.
>> How can I make I rewrite rule that is equivalent to a redirect HTTP (302)
>> ?
>> Because the script uses location.href.lastIndexOf("/") so this is the
>> url of the browser.
>>
>>
>> Le sam. 28 juil. 2018 à 16:06, Sandeep Moré <[email protected]> a
>> écrit :
>>
>>> If this is for a request going in then you can create a rewrite rule that
>>> matches *logsearch and rewrite it to logsearch/.
>>> If this does not work, you can try modifying the request in a custom
>>> dispatch, NiFi dispatch
>>> <
>>> https://github.com/apache/knox/blob/92e2ec59a5940a9e7c67ec5cd29044f811dee40a/gateway-service-nifi/src/main/java/org/apache/knox/gateway/dispatch/NiFiResponseUtil.java#L62
>>> >
>>> does this.
>>>
>>> Best,
>>> Sandeep
>>>
>>> On Sat, Jul 28, 2018 at 9:43 AM David Morin <[email protected]>
>>> wrote:
>>>
>>> > ---------- Forwarded message ---------
>>> > From: David Morin <[email protected]>
>>> > Date: sam. 28 juil. 2018 à 15:34
>>> > Subject: logsearch with knox 0.12.0: errors without the trailing /
>>> > To: <[email protected]>
>>> >
>>> >
>>> > Hello,
>>> >
>>> > I'm quite near to resolve my problem with the double urlencoding with
>>> > logsearch but I still face to an issue that happens when users try the
>>> url
>>> > without a trailing /
>>> > https://XXXX/gateway/default/logsearch instead of
>>> > https://XXXX/gateway/default/logsearch/
>>> >
>>> > I've found that the Init Js file of Logsearch contains this:
>>> >
>>> > require.config({baseUrl: location.href.substring(0,
>>> > location.href.lastIndexOf("/")+1)+"scripts",
>>> >
>>> > Thus, without the trailing / in the request url the logsearch context
>>> > disappears.
>>> >
>>> > How can I handle this issue ?
>>> > For example, how can I replace the String above ?
>>> > Or how to force a redirect that adds the trailing / ?
>>> > https://XXXX/gateway/default/*logsearch* =>
>>> https://XXXX/gateway/default/
>>> > *logsearch/* <https://XXXX/gateway/default/*logsearch/*>
>>> >
>>> > Thanks in advance
>>> >
>>> > David
>>> >
>>>
>>

Reply via email to