You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Scott Harris <sc...@harrisnet.id.au> on 2013/08/13 03:34:22 UTC
remap based on useragent
With our migration to ats we have a requirement to do remaps to different
origin servers based on useragent.
Is there a way to do this with ats or existing plugin or will i need to
write my own plugin to do this?
Scott
Re: remap based on useragent
Posted by Scott Harris <sc...@harrisnet.id.au>.
will try it out, thanks again
Scott
On Tue, Aug 13, 2013 at 11:55 AM, Leif Hedstrom <zw...@apache.org> wrote:
> On Aug 12, 2013, at 7:34 PM, Scott Harris <sc...@harrisnet.id.au> wrote:
>
> > With our migration to ats we have a requirement to do remaps to
> different origin servers based on useragent.
> >
> > Is there a way to do this with ats or existing plugin or will i need to
> write my own plugin to do this?
> >
> > Scott
>
>
> I think the header_rewrite plugin can do this. Been a while since I used
> it, but something like (try this carefully though)
>
> # This is a configuration example when used as a remap plugin rule
>
> cond %{HEADER:User-Agent} /safari/
> set-destination HOST safari.example.com [L]
>
> cond %{HEADER:User-Agent} /msie/
> set-destination HOST msie.exapmple.com [L]
>
> cond %{HEADER:User-Agent} /mozilla/
> set-destination HOST mozilla.example.com [L]
>
>
>
> If you want to use it as a global plugin (that applies to all requests
> regardless of which remap rule triggers), you have to add a condition like
>
> cond %{READ_REQUEST_HDR_HOOK}
>
>
> Again, this is right out of my bu^h^h head, check out the README. I could
> not see any docs for the plugin in Sphinx, not sure if we have one or not ?
> I should probably write one if there isn't one ...
>
> Cheers,
>
> -- Leif
Re: remap based on useragent
Posted by Leif Hedstrom <zw...@apache.org>.
On Aug 12, 2013, at 7:34 PM, Scott Harris <sc...@harrisnet.id.au> wrote:
> With our migration to ats we have a requirement to do remaps to different origin servers based on useragent.
>
> Is there a way to do this with ats or existing plugin or will i need to write my own plugin to do this?
>
> Scott
I think the header_rewrite plugin can do this. Been a while since I used it, but something like (try this carefully though)
# This is a configuration example when used as a remap plugin rule
cond %{HEADER:User-Agent} /safari/
set-destination HOST safari.example.com [L]
cond %{HEADER:User-Agent} /msie/
set-destination HOST msie.exapmple.com [L]
cond %{HEADER:User-Agent} /mozilla/
set-destination HOST mozilla.example.com [L]
If you want to use it as a global plugin (that applies to all requests regardless of which remap rule triggers), you have to add a condition like
cond %{READ_REQUEST_HDR_HOOK}
Again, this is right out of my bu^h^h head, check out the README. I could not see any docs for the plugin in Sphinx, not sure if we have one or not ? I should probably write one if there isn't one ...
Cheers,
-- Leif