You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Dk Jack <dn...@gmail.com> on 2016/03/14 01:54:49 UTC

Intercept Plugin

Hi,
I am using atscppapi intercept Plugin. Does it still require a remap rule
if I am using SERVER_INTERCEPT type. I just want to respond with a custom
response if I see a specific url. Thanks.

Dk.

Re: Intercept Plugin

Posted by Dk Jack <dn...@gmail.com>.
Thanks. I think after cleaning up the config and reloading everything,
things seem to be working fine with the custom plugin.
Thanks everyone for the help.

On Tue, Mar 15, 2016 at 1:18 AM, Luca Rea <lu...@contactlab.com.invalid>
wrote:

> Hi,
>
> The " Not Found on Accelerator " and "Multi-Hop Cycle" logs seem indicate
> that ATS itself is acting as parent/origin for some urls, maybe you should
> take a deeper look at your config files.
>
>
>
> -----Original Message-----
> From: Dk Jack [mailto:dnj0496@gmail.com]
> Sent: lunedì 14 marzo 2016 20:15
> To: dev@trafficserver.apache.org; Alan Carroll
> Subject: Re: Intercept Plugin
>
> Hi Alan,
> I tried to add a remap rule like this:
>
> regex_map http://(.*)/(.*) http://$1/$2
>
> I still get the following error:
>
> 20160314.19h04m03s RESPONSE: sent 127.0.0.1 status 404 (Not Found on
> Accelerator) for 'http://.....'
>
> So I tried your suggestion #2 and set the remap_required to 0 (didn't want
> this but wanted to try it out).
> I got the following error...
>
> 20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 400 (Multi-Hop Cycle
> Detected) for 'http://...'
> 20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 502 (Server Hangup) for
> 'http://....'
>
> don't know what to do at this point...
>
> On Mon, Mar 14, 2016 at 7:42 AM, Alan Carroll <
> solidwallofcode@yahoo-inc.com.invalid> wrote:
>
> > Traffic Server requires either (1) a remap rule or (2) disabling
> > remap_required in records.config. This is not specific to the
> > intercept plugin. If you don't want (2) you can always add an identity
> > remap to remap.config and map the URL to itself.
> >
>

RE: Intercept Plugin

Posted by Luca Rea <lu...@contactlab.com.INVALID>.
Hi,

The " Not Found on Accelerator " and "Multi-Hop Cycle" logs seem indicate that ATS itself is acting as parent/origin for some urls, maybe you should take a deeper look at your config files.



-----Original Message-----
From: Dk Jack [mailto:dnj0496@gmail.com] 
Sent: lunedì 14 marzo 2016 20:15
To: dev@trafficserver.apache.org; Alan Carroll
Subject: Re: Intercept Plugin

Hi Alan,
I tried to add a remap rule like this:

regex_map http://(.*)/(.*) http://$1/$2

I still get the following error:

20160314.19h04m03s RESPONSE: sent 127.0.0.1 status 404 (Not Found on
Accelerator) for 'http://.....'

So I tried your suggestion #2 and set the remap_required to 0 (didn't want this but wanted to try it out).
I got the following error...

20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 400 (Multi-Hop Cycle
Detected) for 'http://...'
20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 502 (Server Hangup) for 'http://....'

don't know what to do at this point...

On Mon, Mar 14, 2016 at 7:42 AM, Alan Carroll < solidwallofcode@yahoo-inc.com.invalid> wrote:

> Traffic Server requires either (1) a remap rule or (2) disabling 
> remap_required in records.config. This is not specific to the 
> intercept plugin. If you don't want (2) you can always add an identity 
> remap to remap.config and map the URL to itself.
>

Re: Intercept Plugin

Posted by Alan Carroll <so...@yahoo-inc.com.INVALID>.
I wouldn't bother with that complex of a remap rule - just turn off remap required entirely.

http://trafficserver.readthedocs.org/en/6.0.x/reference/configuration/records.config.en.html#proxy-config-url-remap-remap-required
If that doesn't work you'll need to turn on debug tags "http|remap" to see what's going on.




On Monday, March 14, 2016 2:15 PM, Dk Jack <dn...@gmail.com> wrote:
Hi Alan,
I tried to add a remap rule like this:

regex_map http://(.*)/(.*) http://$1/$2

I still get the following error:

20160314.19h04m03s RESPONSE: sent 127.0.0.1 status 404 (Not Found on
Accelerator) for 'http://.....'

So I tried your suggestion #2 and set the remap_required to 0 (didn't want
this but wanted to try it out).
I got the following error...

20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 400 (Multi-Hop Cycle
Detected) for 'http://...'
20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 502 (Server Hangup) for
'http://....'

don't know what to do at this point...


On Mon, Mar 14, 2016 at 7:42 AM, Alan Carroll <
solidwallofcode@yahoo-inc.com.invalid> wrote:

> Traffic Server requires either (1) a remap rule or (2) disabling
> remap_required in records.config. This is not specific to the intercept
> plugin. If you don't want (2) you can always add an identity remap to
> remap.config and map the URL to itself.
>

Re: Intercept Plugin

Posted by Dk Jack <dn...@gmail.com>.
is there another way where the TS (or plugin in TS) can act as a server?
thx.

On Mon, Mar 14, 2016 at 12:15 PM, Dk Jack <dn...@gmail.com> wrote:

> Hi Alan,
> I tried to add a remap rule like this:
>
> regex_map http://(.*)/(.*) http://$1/$2
>
> I still get the following error:
>
> 20160314.19h04m03s RESPONSE: sent 127.0.0.1 status 404 (Not Found on
> Accelerator) for 'http://.....'
>
> So I tried your suggestion #2 and set the remap_required to 0 (didn't want
> this but wanted to try it out).
> I got the following error...
>
> 20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 400 (Multi-Hop Cycle
> Detected) for 'http://...'
> 20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 502 (Server Hangup) for
> 'http://....'
>
> don't know what to do at this point...
>
> On Mon, Mar 14, 2016 at 7:42 AM, Alan Carroll <
> solidwallofcode@yahoo-inc.com.invalid> wrote:
>
>> Traffic Server requires either (1) a remap rule or (2) disabling
>> remap_required in records.config. This is not specific to the intercept
>> plugin. If you don't want (2) you can always add an identity remap to
>> remap.config and map the URL to itself.
>>
>
>

Re: Intercept Plugin

Posted by Dk Jack <dn...@gmail.com>.
Hi Alan,
I tried to add a remap rule like this:

regex_map http://(.*)/(.*) http://$1/$2

I still get the following error:

20160314.19h04m03s RESPONSE: sent 127.0.0.1 status 404 (Not Found on
Accelerator) for 'http://.....'

So I tried your suggestion #2 and set the remap_required to 0 (didn't want
this but wanted to try it out).
I got the following error...

20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 400 (Multi-Hop Cycle
Detected) for 'http://...'
20160314.19h07m03s RESPONSE: sent 127.0.0.1 status 502 (Server Hangup) for
'http://....'

don't know what to do at this point...

On Mon, Mar 14, 2016 at 7:42 AM, Alan Carroll <
solidwallofcode@yahoo-inc.com.invalid> wrote:

> Traffic Server requires either (1) a remap rule or (2) disabling
> remap_required in records.config. This is not specific to the intercept
> plugin. If you don't want (2) you can always add an identity remap to
> remap.config and map the URL to itself.
>

Re: Intercept Plugin

Posted by Alan Carroll <so...@yahoo-inc.com.INVALID>.
Traffic Server requires either (1) a remap rule or (2) disabling remap_required in records.config. This is not specific to the intercept plugin. If you don't want (2) you can always add an identity remap to remap.config and map the URL to itself.

Re: Intercept Plugin

Posted by Dk Jack <dn...@gmail.com>.
no luck. I am still stuck with the same error...

20160314.02h43m20s RESPONSE: sent 127.0.0.1 status 404 (Not Found on
Accelerator) for 'http://...'

Since it cannot find a remap rule, it never invokes
the HOOK_SEND_REQUEST_HEADERS hook.
As a result, my custom plugin never gets invoked. I was running into the
same issue with intercept plugin.
I even tried skipping remapping by calling TSSkipRemappingSet in
readRequestHeaders hook, that just
gives me a different error...

20160313.22h51m01s RESPONSE: sent 127.0.0.1 status 400 (Multi-Hop Cycle
Detected) for 'http://....'

Re: Intercept Plugin

Posted by Brian Geffon <br...@gmail.com>.
The example I was referring to is here:
https://github.com/apache/trafficserver/blob/master/lib/atscppapi/examples/customresponse/CustomResponse.cc

In CustomResponseTransactionPlugin::handleSendResponseHeaders() you can
manipulate the response in any other ways you want, in this example it
changes there response status code and message (the body was set w/
.error() in the constructor, but like I said you can also set headers or do
anything else.

Brian

On Mon, Mar 14, 2016 at 9:25 AM, Dk Jack <dn...@gmail.com> wrote:

> ok. I'll give it a try and get back. Thanks.
>
>
>
> On Sun, Mar 13, 2016 at 6:22 PM, Brian Geffon <br...@apache.org> wrote:
>
> > Take a look at the example, you can set the body, status code, headers,
> > basically anything you want. The only reason you might want to use an
> > intercept plugin is it you wanted to stream a response.
> >
> > Brian
> >
> > On Monday, March 14, 2016, Dk Jack <dn...@gmail.com> wrote:
> >
> > > custom error message plugin doesn't seem to include body. I wanted to
> > > include body as well...
> > >
> > > Bhasker.
> > >
> > >
> > > On Sun, Mar 13, 2016 at 6:01 PM, Brian Geffon <briang@apache.org
> > > <javascript:;>> wrote:
> > >
> > > > I would suggest looking at the custom error response plugin in the
> > > examples
> > > > folder, it will give you same result and it's much easier,
> > > >
> > > > Brian
> > > >
> > > > On Monday, March 14, 2016, Dk Jack <dnj0496@gmail.com
> <javascript:;>>
> > > wrote:
> > > >
> > > > > Hi,
> > > > > I am using atscppapi intercept Plugin. Does it still require a
> remap
> > > rule
> > > > > if I am using SERVER_INTERCEPT type. I just want to respond with a
> > > custom
> > > > > response if I see a specific url. Thanks.
> > > > >
> > > > > Dk.
> > > > >
> > > >
> > >
> >
>

Re: Intercept Plugin

Posted by Dk Jack <dn...@gmail.com>.
ok. I'll give it a try and get back. Thanks.



On Sun, Mar 13, 2016 at 6:22 PM, Brian Geffon <br...@apache.org> wrote:

> Take a look at the example, you can set the body, status code, headers,
> basically anything you want. The only reason you might want to use an
> intercept plugin is it you wanted to stream a response.
>
> Brian
>
> On Monday, March 14, 2016, Dk Jack <dn...@gmail.com> wrote:
>
> > custom error message plugin doesn't seem to include body. I wanted to
> > include body as well...
> >
> > Bhasker.
> >
> >
> > On Sun, Mar 13, 2016 at 6:01 PM, Brian Geffon <briang@apache.org
> > <javascript:;>> wrote:
> >
> > > I would suggest looking at the custom error response plugin in the
> > examples
> > > folder, it will give you same result and it's much easier,
> > >
> > > Brian
> > >
> > > On Monday, March 14, 2016, Dk Jack <dnj0496@gmail.com <javascript:;>>
> > wrote:
> > >
> > > > Hi,
> > > > I am using atscppapi intercept Plugin. Does it still require a remap
> > rule
> > > > if I am using SERVER_INTERCEPT type. I just want to respond with a
> > custom
> > > > response if I see a specific url. Thanks.
> > > >
> > > > Dk.
> > > >
> > >
> >
>

Re: Intercept Plugin

Posted by Brian Geffon <br...@apache.org>.
Take a look at the example, you can set the body, status code, headers,
basically anything you want. The only reason you might want to use an
intercept plugin is it you wanted to stream a response.

Brian

On Monday, March 14, 2016, Dk Jack <dn...@gmail.com> wrote:

> custom error message plugin doesn't seem to include body. I wanted to
> include body as well...
>
> Bhasker.
>
>
> On Sun, Mar 13, 2016 at 6:01 PM, Brian Geffon <briang@apache.org
> <javascript:;>> wrote:
>
> > I would suggest looking at the custom error response plugin in the
> examples
> > folder, it will give you same result and it's much easier,
> >
> > Brian
> >
> > On Monday, March 14, 2016, Dk Jack <dnj0496@gmail.com <javascript:;>>
> wrote:
> >
> > > Hi,
> > > I am using atscppapi intercept Plugin. Does it still require a remap
> rule
> > > if I am using SERVER_INTERCEPT type. I just want to respond with a
> custom
> > > response if I see a specific url. Thanks.
> > >
> > > Dk.
> > >
> >
>

Re: Intercept Plugin

Posted by Dk Jack <dn...@gmail.com>.
custom error message plugin doesn't seem to include body. I wanted to
include body as well...

Bhasker.


On Sun, Mar 13, 2016 at 6:01 PM, Brian Geffon <br...@apache.org> wrote:

> I would suggest looking at the custom error response plugin in the examples
> folder, it will give you same result and it's much easier,
>
> Brian
>
> On Monday, March 14, 2016, Dk Jack <dn...@gmail.com> wrote:
>
> > Hi,
> > I am using atscppapi intercept Plugin. Does it still require a remap rule
> > if I am using SERVER_INTERCEPT type. I just want to respond with a custom
> > response if I see a specific url. Thanks.
> >
> > Dk.
> >
>

Re: Intercept Plugin

Posted by Brian Geffon <br...@apache.org>.
I would suggest looking at the custom error response plugin in the examples
folder, it will give you same result and it's much easier,

Brian

On Monday, March 14, 2016, Dk Jack <dn...@gmail.com> wrote:

> Hi,
> I am using atscppapi intercept Plugin. Does it still require a remap rule
> if I am using SERVER_INTERCEPT type. I just want to respond with a custom
> response if I see a specific url. Thanks.
>
> Dk.
>