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/02/13 02:55:29 UTC

remap for internal connections.

Hi,
I am using atscppapi to create my plugin. My plugin spawns a thread and
periodically fetches
data from an external server. I am using the AsyncHttpFetch atscppapi which
internally seems
to use the TSFetchUrl. When I pass my external url to the AsyncHttpFetch
api, my connection
to the external server is failing and I get a 404 error. However, if I
force my plugin to connect to
an arbitrary url (like http://localhost:8888) and add a remap rule as
follows:

regex_map http://(.*):8888/   <external-server-url>

then my external bound http GETs are working. Is there a way to get my
internal fetches to
work without having to write a remap rule? Thanks for your help.

Dj.

Re: remap for internal connections.

Posted by Dnj <dn...@gmail.com>.
Actually, instead of calling TSSkipRemappingSet in pre-map hook, I called it in read-requesthdrs hook. That seems to have helped. Thanks. 


> On Feb 12, 2016, at 8:02 PM, Sudheer Vinukonda <su...@yahoo-inc.com> wrote:
> 
> Can you turn on debug traces (tag: http) and check what might be going on?
> 
> Thanks,
> 
> Sudheer
> 
> 
> 
> On Friday, February 12, 2016, 7:54 PM, Dnj <dn...@gmail.com> wrote:
> 
> That's exactly what I did. I added a global pre map hook. In that, I set the skip remap if it's an internal txn and if the txn URL matches my URL. However, my request still fails with a 404. :(
> 
> Bhasker. 
> 
> > On Feb 12, 2016, at 7:45 PM, Leif Hedstrom <zw...@apache.org> wrote:
> > 
> > 
> >> On Feb 12, 2016, at 7:10 PM, Dk Jack <dn...@gmail.com> wrote:
> >> 
> >> :(
> >> 
> >> Doesn't seem to work. I am calling TSSkipRemappingSet in the PRE_MAP hook.
> >> Is that too late for this setting?
> > 
> > 
> > You added a PRE_MAP hook for the subsequent (FetchSM) request? Typically what you would do here is to have a global PRE_REMAP hook, which does 1 of 2 things (or both):
> > 
> > 
> > 1) Check if it’s an internal request, and if so, turn off remapping
> > 
> > 2) Check the request host / path, and if it matches one that you feel should not require remap, turn it off.
> > 
> > 
> > I hope that makes any sense?
> > 
> > — Leif
> >

Re: remap for internal connections.

Posted by Sudheer Vinukonda <su...@yahoo-inc.com.INVALID>.
 blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important;  padding-left:1ex !important; background-color:white !important; }  Can you turn on debug traces (tag: http) and check what might be going on?
Thanks,
Sudheer




On Friday, February 12, 2016, 7:54 PM, Dnj <dn...@gmail.com> wrote:

That's exactly what I did. I added a global pre map hook. In that, I set the skip remap if it's an internal txn and if the txn URL matches my URL. However, my request still fails with a 404. :(

Bhasker. 

> On Feb 12, 2016, at 7:45 PM, Leif Hedstrom <zw...@apache.org> wrote:
> 
> 
>> On Feb 12, 2016, at 7:10 PM, Dk Jack <dn...@gmail.com> wrote:
>> 
>> :(
>> 
>> Doesn't seem to work. I am calling TSSkipRemappingSet in the PRE_MAP hook.
>> Is that too late for this setting?
> 
> 
> You added a PRE_MAP hook for the subsequent (FetchSM) request? Typically what you would do here is to have a global PRE_REMAP hook, which does 1 of 2 things (or both):
> 
> 
> 1) Check if it’s an internal request, and if so, turn off remapping
> 
> 2) Check the request host / path, and if it matches one that you feel should not require remap, turn it off.
> 
> 
> I hope that makes any sense?
> 
> — Leif
> 
 


Re: remap for internal connections.

Posted by Dnj <dn...@gmail.com>.
That's exactly what I did. I added a global pre map hook. In that, I set the skip remap if it's an internal txn and if the txn URL matches my URL. However, my request still fails with a 404. :(

Bhasker. 

> On Feb 12, 2016, at 7:45 PM, Leif Hedstrom <zw...@apache.org> wrote:
> 
> 
>> On Feb 12, 2016, at 7:10 PM, Dk Jack <dn...@gmail.com> wrote:
>> 
>> :(
>> 
>> Doesn't seem to work. I am calling TSSkipRemappingSet in the PRE_MAP hook.
>> Is that too late for this setting?
> 
> 
> You added a PRE_MAP hook for the subsequent (FetchSM) request? Typically what you would do here is to have a global PRE_REMAP hook, which does 1 of 2 things (or both):
> 
> 
> 1) Check if it’s an internal request, and if so, turn off remapping
> 
> 2) Check the request host / path, and if it matches one that you feel should not require remap, turn it off.
> 
> 
> I hope that makes any sense?
> 
> — Leif
> 

Re: remap for internal connections.

Posted by Leif Hedstrom <zw...@apache.org>.
> On Feb 12, 2016, at 7:10 PM, Dk Jack <dn...@gmail.com> wrote:
> 
> :(
> 
> Doesn't seem to work. I am calling TSSkipRemappingSet in the PRE_MAP hook.
> Is that too late for this setting?


You added a PRE_MAP hook for the subsequent (FetchSM) request? Typically what you would do here is to have a global PRE_REMAP hook, which does 1 of 2 things (or both):


1) Check if it’s an internal request, and if so, turn off remapping

2) Check the request host / path, and if it matches one that you feel should not require remap, turn it off.


I hope that makes any sense?

— Leif


Re: remap for internal connections.

Posted by Dk Jack <dn...@gmail.com>.
:(

Doesn't seem to work. I am calling TSSkipRemappingSet in the PRE_MAP hook.
Is that too late for this setting?


On Fri, Feb 12, 2016 at 6:13 PM, Dk Jack <dn...@gmail.com> wrote:

> Thanks Sudheer!
>
> On Fri, Feb 12, 2016 at 6:06 PM, Sudheer Vinukonda <
> sudheerv@yahoo-inc.com.invalid> wrote:
>
>> You can have your plugin skip remap for a TXN using the TS
>> API   TSSkipRemappingSet.
>> I believe CPP API also added support for this recently
>> with Transaction::setSkipRemapping().
>> https://issues.apache.org/jira/browse/TS-4016
>>
>> Thanks,
>> Sudheer
>>
>>
>>
>> On Friday, February 12, 2016, 5:55 PM, Dk Jack <dn...@gmail.com> wrote:
>>
>> Hi,
>> I am using atscppapi to create my plugin. My plugin spawns a thread and
>> periodically fetches
>> data from an external server. I am using the AsyncHttpFetch atscppapi
>> which
>> internally seems
>> to use the TSFetchUrl. When I pass my external url to the AsyncHttpFetch
>> api, my connection
>> to the external server is failing and I get a 404 error. However, if I
>> force my plugin to connect to
>> an arbitrary url (like http://localhost:8888) and add a remap rule as
>> follows:
>>
>> regex_map http://(.*):8888/   <external-server-url>
>>
>> then my external bound http GETs are working. Is there a way to get my
>> internal fetches to
>> work without having to write a remap rule? Thanks for your help.
>>
>> Dj.
>>
>>
>>
>>
>

Re: remap for internal connections.

Posted by Dk Jack <dn...@gmail.com>.
Thanks Sudheer!

On Fri, Feb 12, 2016 at 6:06 PM, Sudheer Vinukonda <
sudheerv@yahoo-inc.com.invalid> wrote:

> You can have your plugin skip remap for a TXN using the TS
> API   TSSkipRemappingSet.
> I believe CPP API also added support for this recently
> with Transaction::setSkipRemapping().
> https://issues.apache.org/jira/browse/TS-4016
>
> Thanks,
> Sudheer
>
>
>
> On Friday, February 12, 2016, 5:55 PM, Dk Jack <dn...@gmail.com> wrote:
>
> Hi,
> I am using atscppapi to create my plugin. My plugin spawns a thread and
> periodically fetches
> data from an external server. I am using the AsyncHttpFetch atscppapi which
> internally seems
> to use the TSFetchUrl. When I pass my external url to the AsyncHttpFetch
> api, my connection
> to the external server is failing and I get a 404 error. However, if I
> force my plugin to connect to
> an arbitrary url (like http://localhost:8888) and add a remap rule as
> follows:
>
> regex_map http://(.*):8888/   <external-server-url>
>
> then my external bound http GETs are working. Is there a way to get my
> internal fetches to
> work without having to write a remap rule? Thanks for your help.
>
> Dj.
>
>
>
>

Re: remap for internal connections.

Posted by Sudheer Vinukonda <su...@yahoo-inc.com.INVALID>.
You can have your plugin skip remap for a TXN using the TS API   TSSkipRemappingSet. 
I believe CPP API also added support for this recently with Transaction::setSkipRemapping().
https://issues.apache.org/jira/browse/TS-4016

Thanks,
Sudheer



On Friday, February 12, 2016, 5:55 PM, Dk Jack <dn...@gmail.com> wrote:

Hi,
I am using atscppapi to create my plugin. My plugin spawns a thread and
periodically fetches
data from an external server. I am using the AsyncHttpFetch atscppapi which
internally seems
to use the TSFetchUrl. When I pass my external url to the AsyncHttpFetch
api, my connection
to the external server is failing and I get a 404 error. However, if I
force my plugin to connect to
an arbitrary url (like http://localhost:8888) and add a remap rule as
follows:

regex_map http://(.*):8888/   <external-server-url>

then my external bound http GETs are working. Is there a way to get my
internal fetches to
work without having to write a remap rule? Thanks for your help.

Dj.