You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@knox.apache.org by Sean Roberts <sr...@hortonworks.com> on 2018/06/15 14:08:34 UTC

Exclude/skip paths in route or filter?

Knox experts – How would a path be excluded from a route or filter within a Knox service?

For example, in the ‘ambari’ service the filter below converts “text/plain” content to “application/json”.

Many paths needs to be excluded from that conversion.

service.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>:

        <route path="/ambari/api/v1/**">


            <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"/>


            <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>


        </route>


rewrite.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>:

    <filter name="AMBARI/ambari/api/outbound">


        <content type="text/plain" asType="application/json">


            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>


            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>


        </content>


--
Sean Roberts

Re: Exclude/skip paths in route or filter?

Posted by Sean Roberts <sr...@hortonworks.com>.
Sandeep – The problem is that it is needed for most of /api/v1/. Only certain paths need to be skipped.

Is there no condition to bypass certain directories? That is a very important part of rewrite rule systems.

--
Sean Roberts

From: Sandeep Moré <mo...@gmail.com>
Reply-To: "user@knox.apache.org" <us...@knox.apache.org>
Date: Friday, 15 June 2018 at 16:22
To: "user@knox.apache.org" <us...@knox.apache.org>
Subject: Re: Exclude/skip paths in route or filter?

Oh ok, how about we disable it from the service.xml by commenting out that rule for path, something like

     <route path="/ambari/api/v1/**">
            <!--<rewrite apply="AMBARI/ambari/api/outbound" to="response.body"/>-->
            <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>
        </route>

and then selectively enabling only for the path that needs this conversion.

By doing this you will also lose the rewrite rules associated with it, if you want to keep the rules, create another filter add it to the service and remove the asType conversion.

Best,
Sandeep

On Fri, Jun 15, 2018 at 11:10 AM Sean Roberts <sr...@hortonworks.com>> wrote:
Sandeep – Yeah. The interpreting everything that’s text/plain as application/json breaks many paths.

--
Sean Roberts

From: Sandeep Moré <mo...@gmail.com>>
Reply-To: "user@knox.apache.org<ma...@knox.apache.org>" <us...@knox.apache.org>>
Date: Friday, 15 June 2018 at 16:01
To: "user@knox.apache.org<ma...@knox.apache.org>" <us...@knox.apache.org>>
Subject: Re: Exclude/skip paths in route or filter?

Ah, so you would like to skip the entire filter for a specific path ?
On Fri, Jun 15, 2018 at 10:56 AM Sean Roberts <sr...@hortonworks.com>> wrote:
Sandeep – Thanks.

In this case the problem is this filter:
    <filter name="AMBARI/ambari/api/outbound">

        <content type="text/plain" asType="application/json">

            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>

            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>

        </content>


Thoughts on pre-empting it for a specific path?

--
Sean Roberts

From: Sandeep Moré <mo...@gmail.com>>
Reply-To: "user@knox.apache.org<ma...@knox.apache.org>" <us...@knox.apache.org>>
Date: Friday, 15 June 2018 at 15:53
To: "user@knox.apache.org<ma...@knox.apache.org>" <us...@knox.apache.org>>
Cc: Andras Hegedus <ah...@hortonworks.com>>, Péter Vámos <pv...@hortonworks.com>>
Subject: Re: Exclude/skip paths in route or filter?

Hello Sean

It is a bit tricky to exclude a path ( I am assuming you want to do this in some specific scenario ). There are few options I can think of:

Option 1. You can try to make the rules more specific so it can apply only to the URLs we want, the downside is, since we are narrowing the rule there is a high chance of other path failures.

Option 2. Create an exact rule for the patch you want to exclude and make the rule empty or just rewrite the existing path, make sure you add the corresponding patch to service.xml file.

Option 3. Use the flow=AND and flow=OR conditions with option 2. This is not ideal for excluding a path but it could be a better option.

e.g.
<rule name="test-rule-with-complex-flow" flow="OR">
    <!-- Path to exclude -->
    <match pattern="*://*:*/~/{path=**}?{**}">
        <!-- Here we can keep the URL unchanged -->
        <rewrite template="test-scheme-output://test-host-output:777/test-path-output/test-home/~{path=**}?{**}"/>
    </match>
    <match pattern="*://*:*/{path=**}?{**}">
        <rewrite template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
    </match>
</rule>
Where
OR = At least one condition proceeding a set of one or more actions must succeed for the actions to be executed.
AND = All conditions proceeding a set of one or more actions must succeed for the actions to be executed.



Best,
Sandeep

On Fri, Jun 15, 2018 at 10:08 AM Sean Roberts <sr...@hortonworks.com>> wrote:
Knox experts – How would a path be excluded from a route or filter within a Knox service?

For example, in the ‘ambari’ service the filter below converts “text/plain” content to “application/json”.

Many paths needs to be excluded from that conversion.

service.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>:

        <route path="/ambari/api/v1/**">


            <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"/>


            <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>


        </route>


rewrite.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>:

    <filter name="AMBARI/ambari/api/outbound">


        <content type="text/plain" asType="application/json">


            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>


            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>


        </content>


--
Sean Roberts

Re: Exclude/skip paths in route or filter?

Posted by Sandeep Moré <mo...@gmail.com>.
Oh ok, how about we disable it from the service.xml by commenting out that
rule for path, something like

     <route path="/ambari/api/v1/**">
            <!--<rewrite apply="AMBARI/ambari/api/outbound"
to="response.body"/>-->
            <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>
        </route>

and then selectively enabling only for the path that needs this conversion.

By doing this you will also lose the rewrite rules associated with it, if
you want to keep the rules, create another filter add it to the service and
remove the asType conversion.

Best,
Sandeep

On Fri, Jun 15, 2018 at 11:10 AM Sean Roberts <sr...@hortonworks.com>
wrote:

> Sandeep – Yeah. The interpreting everything that’s text/plain as
> application/json breaks many paths.
>
>
>
> --
>
> Sean Roberts
>
>
>
> *From: *Sandeep Moré <mo...@gmail.com>
> *Reply-To: *"user@knox.apache.org" <us...@knox.apache.org>
> *Date: *Friday, 15 June 2018 at 16:01
> *To: *"user@knox.apache.org" <us...@knox.apache.org>
> *Subject: *Re: Exclude/skip paths in route or filter?
>
>
>
> Ah, so you would like to skip the entire filter for a specific path ?
>
> On Fri, Jun 15, 2018 at 10:56 AM Sean Roberts <sr...@hortonworks.com>
> wrote:
>
> Sandeep – Thanks.
>
>
>
> In this case the problem is this filter:
>
>     <filter name="AMBARI/ambari/api/outbound">
>
>         <content type="text/plain" asType="application/json">
>
>             <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>
>
>             <apply path="$.**.context_path" rule=
> "AMBARI/ambari/context_path/outbound"/>
>
>         </content>
>
>
>
> Thoughts on pre-empting it for a specific path?
>
>
>
> --
>
> Sean Roberts
>
>
>
> *From: *Sandeep Moré <mo...@gmail.com>
> *Reply-To: *"user@knox.apache.org" <us...@knox.apache.org>
> *Date: *Friday, 15 June 2018 at 15:53
> *To: *"user@knox.apache.org" <us...@knox.apache.org>
> *Cc: *Andras Hegedus <ah...@hortonworks.com>, Péter Vámos <
> pvamos@hortonworks.com>
> *Subject: *Re: Exclude/skip paths in route or filter?
>
>
>
> Hello Sean
>
>
>
> It is a bit tricky to exclude a path ( I am assuming you want to do this
> in some specific scenario ). There are few options I can think of:
>
>
>
> Option 1. You can try to make the rules more specific so it can apply only
> to the URLs we want, the downside is, since we are narrowing the rule there
> is a high chance of other path failures.
>
>
>
> Option 2. Create an exact rule for the patch you want to exclude and make
> the rule empty or just rewrite the existing path, make sure you add the
> corresponding patch to service.xml file.
>
>
>
> Option 3. Use the flow=AND and flow=OR conditions with option 2. This is
> not ideal for excluding a path but it could be a better option.
>
>
>
> e.g.
>
> <rule name="test-rule-with-complex-flow" flow="OR">
>     <!-- Path to exclude -->
>
>     <match pattern="*://*:*/~/{path=**}?{**}">
>         <!-- Here we can keep the URL unchanged -->
>
>         <rewrite
> template="test-scheme-output://test-host-output:777/test-path-output/test-home/~{path=**}?{**}"/>
>     </match>
>     <match pattern="*://*:*/{path=**}?{**}">
>         <rewrite
> template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
>     </match>
> </rule>
>
> Where
>
> OR = At least one condition proceeding a set of one or more actions must
> succeed for the actions to be executed.
> AND = All conditions proceeding a set of one or more actions must succeed
> for the actions to be executed.
>
>
>
>
>
>
>
> Best,
>
> Sandeep
>
>
>
> On Fri, Jun 15, 2018 at 10:08 AM Sean Roberts <sr...@hortonworks.com>
> wrote:
>
> Knox experts – How would a path be excluded from a route or filter within
> a Knox service?
>
>
>
> For example, in the ‘ambari’ service the filter below converts
> “text/plain” content to “application/json”.
>
>
>
> Many paths needs to be excluded from that conversion.
>
>
>
> service.xml
> <https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>
> :
>
>         <route path="/ambari/api/v1/**">
>
>             <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"
> />
>
>             <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>
>
>         </route>
>
>
>
> rewrite.xml
> <https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>
> :
>
>     <filter name="AMBARI/ambari/api/outbound">
>
>         <content type="text/plain" asType="application/json">
>
>             <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>
>
>             <apply path="$.**.context_path" rule=
> "AMBARI/ambari/context_path/outbound"/>
>
>         </content>
>
>
>
> --
>
> Sean Roberts
>
>

Re: Exclude/skip paths in route or filter?

Posted by Sean Roberts <sr...@hortonworks.com>.
Sandeep – Yeah. The interpreting everything that’s text/plain as application/json breaks many paths.

--
Sean Roberts

From: Sandeep Moré <mo...@gmail.com>
Reply-To: "user@knox.apache.org" <us...@knox.apache.org>
Date: Friday, 15 June 2018 at 16:01
To: "user@knox.apache.org" <us...@knox.apache.org>
Subject: Re: Exclude/skip paths in route or filter?

Ah, so you would like to skip the entire filter for a specific path ?
On Fri, Jun 15, 2018 at 10:56 AM Sean Roberts <sr...@hortonworks.com>> wrote:
Sandeep – Thanks.

In this case the problem is this filter:
    <filter name="AMBARI/ambari/api/outbound">

        <content type="text/plain" asType="application/json">

            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>

            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>

        </content>


Thoughts on pre-empting it for a specific path?

--
Sean Roberts

From: Sandeep Moré <mo...@gmail.com>>
Reply-To: "user@knox.apache.org<ma...@knox.apache.org>" <us...@knox.apache.org>>
Date: Friday, 15 June 2018 at 15:53
To: "user@knox.apache.org<ma...@knox.apache.org>" <us...@knox.apache.org>>
Cc: Andras Hegedus <ah...@hortonworks.com>>, Péter Vámos <pv...@hortonworks.com>>
Subject: Re: Exclude/skip paths in route or filter?

Hello Sean

It is a bit tricky to exclude a path ( I am assuming you want to do this in some specific scenario ). There are few options I can think of:

Option 1. You can try to make the rules more specific so it can apply only to the URLs we want, the downside is, since we are narrowing the rule there is a high chance of other path failures.

Option 2. Create an exact rule for the patch you want to exclude and make the rule empty or just rewrite the existing path, make sure you add the corresponding patch to service.xml file.

Option 3. Use the flow=AND and flow=OR conditions with option 2. This is not ideal for excluding a path but it could be a better option.

e.g.
<rule name="test-rule-with-complex-flow" flow="OR">
    <!-- Path to exclude -->
    <match pattern="*://*:*/~/{path=**}?{**}">
        <!-- Here we can keep the URL unchanged -->
        <rewrite template="test-scheme-output://test-host-output:777/test-path-output/test-home/~{path=**}?{**}"/>
    </match>
    <match pattern="*://*:*/{path=**}?{**}">
        <rewrite template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
    </match>
</rule>
Where
OR = At least one condition proceeding a set of one or more actions must succeed for the actions to be executed.
AND = All conditions proceeding a set of one or more actions must succeed for the actions to be executed.



Best,
Sandeep

On Fri, Jun 15, 2018 at 10:08 AM Sean Roberts <sr...@hortonworks.com>> wrote:
Knox experts – How would a path be excluded from a route or filter within a Knox service?

For example, in the ‘ambari’ service the filter below converts “text/plain” content to “application/json”.

Many paths needs to be excluded from that conversion.

service.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>:

        <route path="/ambari/api/v1/**">


            <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"/>


            <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>


        </route>


rewrite.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>:

    <filter name="AMBARI/ambari/api/outbound">


        <content type="text/plain" asType="application/json">


            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>


            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>


        </content>


--
Sean Roberts

Re: Exclude/skip paths in route or filter?

Posted by Sandeep Moré <mo...@gmail.com>.
Ah, so you would like to skip the entire filter for a specific path ?

On Fri, Jun 15, 2018 at 10:56 AM Sean Roberts <sr...@hortonworks.com>
wrote:

> Sandeep – Thanks.
>
>
>
> In this case the problem is this filter:
>
>     <filter name="AMBARI/ambari/api/outbound">
>
>         <content type="text/plain" asType="application/json">
>
>             <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>
>
>             <apply path="$.**.context_path" rule=
> "AMBARI/ambari/context_path/outbound"/>
>
>         </content>
>
>
>
> Thoughts on pre-empting it for a specific path?
>
>
>
> --
>
> Sean Roberts
>
>
>
> *From: *Sandeep Moré <mo...@gmail.com>
> *Reply-To: *"user@knox.apache.org" <us...@knox.apache.org>
> *Date: *Friday, 15 June 2018 at 15:53
> *To: *"user@knox.apache.org" <us...@knox.apache.org>
> *Cc: *Andras Hegedus <ah...@hortonworks.com>, Péter Vámos <
> pvamos@hortonworks.com>
> *Subject: *Re: Exclude/skip paths in route or filter?
>
>
>
> Hello Sean
>
>
>
> It is a bit tricky to exclude a path ( I am assuming you want to do this
> in some specific scenario ). There are few options I can think of:
>
>
>
> Option 1. You can try to make the rules more specific so it can apply only
> to the URLs we want, the downside is, since we are narrowing the rule there
> is a high chance of other path failures.
>
>
>
> Option 2. Create an exact rule for the patch you want to exclude and make
> the rule empty or just rewrite the existing path, make sure you add the
> corresponding patch to service.xml file.
>
>
>
> Option 3. Use the flow=AND and flow=OR conditions with option 2. This is
> not ideal for excluding a path but it could be a better option.
>
>
>
> e.g.
>
> <rule name="test-rule-with-complex-flow" flow="OR">
>     <!-- Path to exclude -->
>
>     <match pattern="*://*:*/~/{path=**}?{**}">
>         <!-- Here we can keep the URL unchanged -->
>
>         <rewrite
> template="test-scheme-output://test-host-output:777/test-path-output/test-home/~{path=**}?{**}"/>
>     </match>
>     <match pattern="*://*:*/{path=**}?{**}">
>         <rewrite
> template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
>     </match>
> </rule>
>
> Where
>
> OR = At least one condition proceeding a set of one or more actions must
> succeed for the actions to be executed.
> AND = All conditions proceeding a set of one or more actions must succeed
> for the actions to be executed.
>
>
>
>
>
>
>
> Best,
>
> Sandeep
>
>
>
> On Fri, Jun 15, 2018 at 10:08 AM Sean Roberts <sr...@hortonworks.com>
> wrote:
>
> Knox experts – How would a path be excluded from a route or filter within
> a Knox service?
>
>
>
> For example, in the ‘ambari’ service the filter below converts
> “text/plain” content to “application/json”.
>
>
>
> Many paths needs to be excluded from that conversion.
>
>
>
> service.xml
> <https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>
> :
>
>         <route path="/ambari/api/v1/**">
>
>             <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"
> />
>
>             <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>
>
>         </route>
>
>
>
> rewrite.xml
> <https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>
> :
>
>     <filter name="AMBARI/ambari/api/outbound">
>
>         <content type="text/plain" asType="application/json">
>
>             <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>
>
>             <apply path="$.**.context_path" rule=
> "AMBARI/ambari/context_path/outbound"/>
>
>         </content>
>
>
>
> --
>
> Sean Roberts
>
>

Re: Exclude/skip paths in route or filter?

Posted by Sean Roberts <sr...@hortonworks.com>.
Sandeep – Thanks.

In this case the problem is this filter:
    <filter name="AMBARI/ambari/api/outbound">

        <content type="text/plain" asType="application/json">

            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>

            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>

        </content>


Thoughts on pre-empting it for a specific path?

--
Sean Roberts

From: Sandeep Moré <mo...@gmail.com>
Reply-To: "user@knox.apache.org" <us...@knox.apache.org>
Date: Friday, 15 June 2018 at 15:53
To: "user@knox.apache.org" <us...@knox.apache.org>
Cc: Andras Hegedus <ah...@hortonworks.com>, Péter Vámos <pv...@hortonworks.com>
Subject: Re: Exclude/skip paths in route or filter?

Hello Sean

It is a bit tricky to exclude a path ( I am assuming you want to do this in some specific scenario ). There are few options I can think of:

Option 1. You can try to make the rules more specific so it can apply only to the URLs we want, the downside is, since we are narrowing the rule there is a high chance of other path failures.

Option 2. Create an exact rule for the patch you want to exclude and make the rule empty or just rewrite the existing path, make sure you add the corresponding patch to service.xml file.

Option 3. Use the flow=AND and flow=OR conditions with option 2. This is not ideal for excluding a path but it could be a better option.

e.g.
<rule name="test-rule-with-complex-flow" flow="OR">
    <!-- Path to exclude -->
    <match pattern="*://*:*/~/{path=**}?{**}">
        <!-- Here we can keep the URL unchanged -->
        <rewrite template="test-scheme-output://test-host-output:777/test-path-output/test-home/~{path=**}?{**}"/>
    </match>
    <match pattern="*://*:*/{path=**}?{**}">
        <rewrite template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
    </match>
</rule>
Where
OR = At least one condition proceeding a set of one or more actions must succeed for the actions to be executed.
AND = All conditions proceeding a set of one or more actions must succeed for the actions to be executed.



Best,
Sandeep

On Fri, Jun 15, 2018 at 10:08 AM Sean Roberts <sr...@hortonworks.com>> wrote:
Knox experts – How would a path be excluded from a route or filter within a Knox service?

For example, in the ‘ambari’ service the filter below converts “text/plain” content to “application/json”.

Many paths needs to be excluded from that conversion.

service.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>:

        <route path="/ambari/api/v1/**">


            <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"/>


            <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>


        </route>


rewrite.xml<https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>:

    <filter name="AMBARI/ambari/api/outbound">


        <content type="text/plain" asType="application/json">


            <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>


            <apply path="$.**.context_path" rule="AMBARI/ambari/context_path/outbound"/>


        </content>


--
Sean Roberts

Re: Exclude/skip paths in route or filter?

Posted by Sandeep Moré <mo...@gmail.com>.
Hello Sean

It is a bit tricky to exclude a path ( I am assuming you want to do this in
some specific scenario ). There are few options I can think of:

Option 1. You can try to make the rules more specific so it can apply only
to the URLs we want, the downside is, since we are narrowing the rule there
is a high chance of other path failures.

Option 2. Create an exact rule for the patch you want to exclude and make
the rule empty or just rewrite the existing path, make sure you add the
corresponding patch to service.xml file.

Option 3. Use the flow=AND and flow=OR conditions with option 2. This is
not ideal for excluding a path but it could be a better option.

e.g.
<rule name="test-rule-with-complex-flow" flow="OR">
    <!-- Path to exclude -->
    <match pattern="*://*:*/~/{path=**}?{**}">
        <!-- Here we can keep the URL unchanged -->
        <rewrite
template="test-scheme-output://test-host-output:777/test-path-output/test-home/~{path=**}?{**}"/>
    </match>
    <match pattern="*://*:*/{path=**}?{**}">
        <rewrite
template="test-scheme-output://test-host-output:42/test-path-output/{path}?{**}"/>
    </match>
</rule>

Where
OR = At least one condition proceeding a set of one or more actions must
succeed for the actions to be executed.
AND = All conditions proceeding a set of one or more actions must succeed
for the actions to be executed.



Best,
Sandeep

On Fri, Jun 15, 2018 at 10:08 AM Sean Roberts <sr...@hortonworks.com>
wrote:

> Knox experts – How would a path be excluded from a route or filter within
> a Knox service?
>
>
>
> For example, in the ‘ambari’ service the filter below converts
> “text/plain” content to “application/json”.
>
>
>
> Many paths needs to be excluded from that conversion.
>
>
>
> service.xml
> <https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/service.xml#L24-L28>
> :
>
>         <route path="/ambari/api/v1/**">
>
>             <rewrite apply="AMBARI/ambari/api/outbound" to="response.body"
> />
>
>             <rewrite apply="AMBARI/ambari/api/inbound" to="request.body"/>
>
>         </route>
>
>
>
> rewrite.xml
> <https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambari/2.2.0/rewrite.xml#L29-L33>
> :
>
>     <filter name="AMBARI/ambari/api/outbound">
>
>         <content type="text/plain" asType="application/json">
>
>             <apply path="$.**.href" rule="AMBARI/ambari/href/outbound"/>
>
>             <apply path="$.**.context_path" rule=
> "AMBARI/ambari/context_path/outbound"/>
>
>         </content>
>
>
>
> --
>
> Sean Roberts
>