You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Rakesh G K <rg...@gmail.com> on 2014/01/07 13:10:10 UTC

Specifying mapping in remap.config for a cluster mode deployment

Hello,

When in a clustered mode deployment, I need to be able to map certain
requests that an ats node receives to the origin server.
When I have a load balancer fronting the cluster, there is no way of
knowing which server which get what request. So assuming that there are 3
ats nodes, and a origin server URL, say http://www.example.com/origin, is
there a better way of remapping this than what is written below?

*map http://www.ats1.com/origin <http://www.ats1.com/origin>
http://www.example.com/origin <http://www.example.com/origin>*
*map http://**www.**ats2.com/origin <http://ats2.com/origin>
http://www.example.com/origin <http://www.example.com/origin>*
*map http://**www.**ats3.com/origin <http://ats3.com/origin>
http://www.example.com/origin <http://www.example.com/origin>*

Instead of having 3 different entries for the same destination, can the
source hostname (like www.ats1.com, www.ats2.com etc) be changed something
generic so that I dont have make an entry for every node's hostname and
have a single entry for all the nodes in the cluster?.

Thanks,
Rakesh

Re: Specifying mapping in remap.config for a cluster mode deployment

Posted by Rakesh G K <rg...@gmail.com>.
Thanks James,

I was able to get ATS to work with regex_map as you suggested. It was
fairly straight forward and answered my query.

Regards,
Rakesh


On Wed, Jan 8, 2014 at 11:31 PM, Rakesh G K <rg...@gmail.com> wrote:

> Yes James,
> I was trying out with that itself. Will post the results on the forum
> after concluding on it tomorrow. Regex in the hostname can be used for the
> origin-server URL as well right?
>
>
>
> On Wed, Jan 8, 2014 at 9:52 PM, James Peach <jp...@apache.org> wrote:
>
>> On Jan 8, 2014, at 1:40 AM, Rakesh G K <rg...@gmail.com> wrote:
>>
>> > Thanks Leif.
>> > But what i was trying to convey was a bit different.
>> > I have 'n' ats nodes, 'm' tomcat instances and 'p' services offered by
>> each of the tomcat servers. So instead of having 'n' X 'm' X 'p' different
>> entries in the remap.config, I was wondering if it is possible to have just
>> 'p' entries for each of the services, by somehow having a single identifier
>> for the ats and a single identifier for any of the tomcat.
>> >
>> > Is this realizable? Or should all of these entries be mentioned?.
>>
>> Would the regex_map mapping type work for you?
>>
>>
>> https://trafficserver.readthedocs.org/en/latest/reference/configuration/remap.config.en.html#regular-expression-regex-remap-support
>>
>> regex_map http://www.ats[0-9]+.com/origin http://www.example.com.origin
>>
>> >
>> > -Rakesh
>> >
>> >
>> > On Tue, Jan 7, 2014 at 10:40 PM, Leif Hedstrom <zw...@apache.org>
>> wrote:
>> >
>> > On Jan 7, 2014, at 5:10 AM, Rakesh G K <rg...@gmail.com> wrote:
>> >
>> >> Hello,
>> >>
>> >> When in a clustered mode deployment, I need to be able to map certain
>> requests that an ats node receives to the origin server.
>> >> When I have a load balancer fronting the cluster, there is no way of
>> knowing which server which get what request. So assuming that there are 3
>> ats nodes, and a origin server URL, say http://www.example.com/origin,
>> is there a better way of remapping this than what is written below?
>> >>
>> >> map http://www.ats1.com/origin http://www.example.com/origin
>> >> map http://www.ats2.com/origin http://www.example.com/origin
>> >> map http://www.ats3.com/origin http://www.example.com/origin
>> >>
>> >> I
>> >
>> >
>> > This sounds like a case where you want to keep pristine Host headers
>> across the board. That would imply making sure your origins can handle
>> those “client” submitted Host: header, but would allow for a single,
>> unified remap config across the board. Just make sure you have
>> >
>> >       CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
>> >
>> >
>> > That is the default as well. Now, I’m not a clustering expert, so maybe
>> cluster doesn’t honor this. If it doesn’t, that smells like a bug to me.
>> >
>> > — Leif
>> >
>> >
>>
>>
>

Re: Specifying mapping in remap.config for a cluster mode deployment

Posted by Rakesh G K <rg...@gmail.com>.
Yes James,
I was trying out with that itself. Will post the results on the forum after
concluding on it tomorrow. Regex in the hostname can be used for the
origin-server URL as well right?



On Wed, Jan 8, 2014 at 9:52 PM, James Peach <jp...@apache.org> wrote:

> On Jan 8, 2014, at 1:40 AM, Rakesh G K <rg...@gmail.com> wrote:
>
> > Thanks Leif.
> > But what i was trying to convey was a bit different.
> > I have 'n' ats nodes, 'm' tomcat instances and 'p' services offered by
> each of the tomcat servers. So instead of having 'n' X 'm' X 'p' different
> entries in the remap.config, I was wondering if it is possible to have just
> 'p' entries for each of the services, by somehow having a single identifier
> for the ats and a single identifier for any of the tomcat.
> >
> > Is this realizable? Or should all of these entries be mentioned?.
>
> Would the regex_map mapping type work for you?
>
>
> https://trafficserver.readthedocs.org/en/latest/reference/configuration/remap.config.en.html#regular-expression-regex-remap-support
>
> regex_map http://www.ats[0-9]+.com/origin http://www.example.com.origin
>
> >
> > -Rakesh
> >
> >
> > On Tue, Jan 7, 2014 at 10:40 PM, Leif Hedstrom <zw...@apache.org> wrote:
> >
> > On Jan 7, 2014, at 5:10 AM, Rakesh G K <rg...@gmail.com> wrote:
> >
> >> Hello,
> >>
> >> When in a clustered mode deployment, I need to be able to map certain
> requests that an ats node receives to the origin server.
> >> When I have a load balancer fronting the cluster, there is no way of
> knowing which server which get what request. So assuming that there are 3
> ats nodes, and a origin server URL, say http://www.example.com/origin, is
> there a better way of remapping this than what is written below?
> >>
> >> map http://www.ats1.com/origin http://www.example.com/origin
> >> map http://www.ats2.com/origin http://www.example.com/origin
> >> map http://www.ats3.com/origin http://www.example.com/origin
> >>
> >> I
> >
> >
> > This sounds like a case where you want to keep pristine Host headers
> across the board. That would imply making sure your origins can handle
> those “client” submitted Host: header, but would allow for a single,
> unified remap config across the board. Just make sure you have
> >
> >       CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
> >
> >
> > That is the default as well. Now, I’m not a clustering expert, so maybe
> cluster doesn’t honor this. If it doesn’t, that smells like a bug to me.
> >
> > — Leif
> >
> >
>
>

Re: Specifying mapping in remap.config for a cluster mode deployment

Posted by James Peach <jp...@apache.org>.
On Jan 8, 2014, at 1:40 AM, Rakesh G K <rg...@gmail.com> wrote:

> Thanks Leif. 
> But what i was trying to convey was a bit different.
> I have 'n' ats nodes, 'm' tomcat instances and 'p' services offered by each of the tomcat servers. So instead of having 'n' X 'm' X 'p' different entries in the remap.config, I was wondering if it is possible to have just 'p' entries for each of the services, by somehow having a single identifier for the ats and a single identifier for any of the tomcat.
> 
> Is this realizable? Or should all of these entries be mentioned?.

Would the regex_map mapping type work for you?

https://trafficserver.readthedocs.org/en/latest/reference/configuration/remap.config.en.html#regular-expression-regex-remap-support

regex_map http://www.ats[0-9]+.com/origin http://www.example.com.origin

> 
> -Rakesh
> 
> 
> On Tue, Jan 7, 2014 at 10:40 PM, Leif Hedstrom <zw...@apache.org> wrote:
> 
> On Jan 7, 2014, at 5:10 AM, Rakesh G K <rg...@gmail.com> wrote:
> 
>> Hello,
>> 
>> When in a clustered mode deployment, I need to be able to map certain requests that an ats node receives to the origin server. 
>> When I have a load balancer fronting the cluster, there is no way of knowing which server which get what request. So assuming that there are 3 ats nodes, and a origin server URL, say http://www.example.com/origin, is there a better way of remapping this than what is written below?
>> 
>> map http://www.ats1.com/origin http://www.example.com/origin
>> map http://www.ats2.com/origin http://www.example.com/origin
>> map http://www.ats3.com/origin http://www.example.com/origin
>> 
>> I
> 
> 
> This sounds like a case where you want to keep pristine Host headers across the board. That would imply making sure your origins can handle those “client” submitted Host: header, but would allow for a single, unified remap config across the board. Just make sure you have
> 
> 	CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
> 
> 
> That is the default as well. Now, I’m not a clustering expert, so maybe cluster doesn’t honor this. If it doesn’t, that smells like a bug to me.
> 
> — Leif
> 
> 


Re: Specifying mapping in remap.config for a cluster mode deployment

Posted by Rakesh G K <rg...@gmail.com>.
Thanks Leif.
But what i was trying to convey was a bit different.
I have 'n' ats nodes, 'm' tomcat instances and 'p' services offered by each
of the tomcat servers. So instead of having 'n' X 'm' X 'p' different
entries in the remap.config, I was wondering if it is possible to have just
'p' entries for each of the services, by somehow having a single identifier
for the ats and a single identifier for any of the tomcat.

Is this realizable? Or should all of these entries be mentioned?.

-Rakesh


On Tue, Jan 7, 2014 at 10:40 PM, Leif Hedstrom <zw...@apache.org> wrote:

>
> On Jan 7, 2014, at 5:10 AM, Rakesh G K <rg...@gmail.com> wrote:
>
> Hello,
>
> When in a clustered mode deployment, I need to be able to map certain
> requests that an ats node receives to the origin server.
> When I have a load balancer fronting the cluster, there is no way of
> knowing which server which get what request. So assuming that there are 3
> ats nodes, and a origin server URL, say http://www.example.com/origin, is
> there a better way of remapping this than what is written below?
>
> *map http://www.ats1.com/origin <http://www.ats1.com/origin>
> http://www.example.com/origin <http://www.example.com/origin>*
> *map http://**www.**ats2.com/origin <http://ats2.com/origin>
> http://www.example.com/origin <http://www.example.com/origin>*
> *map http://**www.**ats3.com/origin <http://ats3.com/origin>
> http://www.example.com/origin <http://www.example.com/origin>*
>
> I
>
>
>
> This sounds like a case where you want to keep pristine Host headers
> across the board. That would imply making sure your origins can handle
> those “client” submitted Host: header, but would allow for a single,
> unified remap config across the board. Just make sure you have
>
> CONFIG proxy.config.url_remap.pristine_host_hdr INT 1
>
>
> That is the default as well. Now, I’m not a clustering expert, so maybe
> cluster doesn’t honor this. If it doesn’t, that smells like a bug to me.
>
> — Leif
>
>

Re: Specifying mapping in remap.config for a cluster mode deployment

Posted by Leif Hedstrom <zw...@apache.org>.
On Jan 7, 2014, at 5:10 AM, Rakesh G K <rg...@gmail.com> wrote:

> Hello,
> 
> When in a clustered mode deployment, I need to be able to map certain requests that an ats node receives to the origin server. 
> When I have a load balancer fronting the cluster, there is no way of knowing which server which get what request. So assuming that there are 3 ats nodes, and a origin server URL, say http://www.example.com/origin, is there a better way of remapping this than what is written below?
> 
> map http://www.ats1.com/origin http://www.example.com/origin
> map http://www.ats2.com/origin http://www.example.com/origin
> map http://www.ats3.com/origin http://www.example.com/origin
> 
> I


This sounds like a case where you want to keep pristine Host headers across the board. That would imply making sure your origins can handle those “client” submitted Host: header, but would allow for a single, unified remap config across the board. Just make sure you have

	CONFIG proxy.config.url_remap.pristine_host_hdr INT 1


That is the default as well. Now, I’m not a clustering expert, so maybe cluster doesn’t honor this. If it doesn’t, that smells like a bug to me.

— Leif