You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by ezko <er...@harmonicinc.com> on 2020/01/12 16:57:41 UTC

path based hosting.config

Hi,
we are using ATS 8.0.5
we have an origin which serves both live and VOD (different paths) , and
would like to cache live on block RAM disk and VOD on SSD

example origin urls:
http://origin.mydomain.com/live
http://origin.mydomain.com/vod

from the DOCS it doesn't seem like there is support for specifying paths in
hosting.config 
so the following will not work right ?

hostname=origin.mydomain.com/live volume=1
hostname=origin.mydomain.com/vod volume=2

is there another way (maybe using a plugin) ?

BR,
erez




--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by Leif Hedstrom <zw...@apache.org>.

> On Jan 12, 2020, at 12:16 PM, Jeremy Payne <jp...@gmail.com> wrote:
> 
> pulled the below lua from my work notes..
> 
> ++
> function send_request()
>    ts.server_request.header['Host'] = "real-origin.fqdn.com"
> end
> 
> function do_remap()
> 
> -- this is what i use to segment various file types to different volumes
> -- but will work to separate volumes using the same remap fqdns but
> different paths
> -- enabling pristine is required
> 
>    ts.http.config_int_set(TS_LUA_CONFIG_URL_REMAP_PRISTINE_HOST_HDR, 1)
>    ts.client_request.header['Host'] = "live.fqdn.com"
> 
> -- restore origin HOST header
> 
>    ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)
>    return 0
> 
> 
> end


Sweet!

Derailing: What happened to the ideas around making some “Cook Book” style collections of useful Lua, header_rewrite, and other plugin (transaction box?) scripts and configurations ? I think this is probably an area where we can really make a difference for people getting started with ATS.

Cheers,

— leif


Re: path based hosting.config

Posted by ezko <er...@harmonicinc.com>.
Thanks.

we tried the lua solution from Jeremy and it works great.
so the next question is:
is there some way to apply (at the same) the same trick for parent
selection.
that is temporarily replace the host name used for parent selection , and
then restore it.

Thanks,
erez




--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by Jeremy Payne <jp...@gmail.com>.
You can see which volume is being used by enabling these debug tags.

cache_hosting|http_seq

On Tue, Jan 14, 2020 at 12:25 PM ezko <er...@harmonicinc.com> wrote:
>
> Thanks for the suggestions.
> we are trying with the header rewrite plugin , but can't get it to work
> (even unconditionally):
>
> we enabled pristine: proxy.config.url_remap.pristine_host_hdr 1
> added a remap with a fake origin:
> map  http://from.xx/ http://to-fake-host.xx/ @plugin=header_rewrite.so
> @pparam=restore.config
>
> restore.config:
> cond %{SEND_REQUEST_HDR_HOOK}
> cond %{INCOMING-PORT} = 80
> set-header Host real-origin.xx
> # set-destination HOST real-origin.xx <-- also doesn't work
>
> This doesn't change the origin. why ?
>
> Another issue is how can we tell which volume was used to cache ?
> we are using cache inspector but it's cumbersome and when certain plugins
> are added to the remap line it just returns "Cache Lookup Failed, or missing
> in cluster". using debug tag cache_hosting gives some insight , but not
> enough ? is there anything else ?
>
> Thanks,
> erez
>
>
>
>
> --
> Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by ezko <er...@harmonicinc.com>.
Thanks for the suggestions.
we are trying with the header rewrite plugin , but can't get it to work
(even unconditionally):

we enabled pristine: proxy.config.url_remap.pristine_host_hdr 1
added a remap with a fake origin:
map  http://from.xx/ http://to-fake-host.xx/ @plugin=header_rewrite.so
@pparam=restore.config

restore.config:
cond %{SEND_REQUEST_HDR_HOOK}
cond %{INCOMING-PORT} = 80
set-header Host real-origin.xx 
# set-destination HOST real-origin.xx <-- also doesn't work

This doesn't change the origin. why ?

Another issue is how can we tell which volume was used to cache ? 
we are using cache inspector but it's cumbersome and when certain plugins
are added to the remap line it just returns "Cache Lookup Failed, or missing
in cluster". using debug tag cache_hosting gives some insight , but not
enough ? is there anything else ?

Thanks,
erez




--
Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by Jeremy Payne <jp...@gmail.com>.
You will also have to update your hosting.config to match the volume
where the 'dynamically' set client HOST header should reside.

On Sun, Jan 12, 2020 at 1:16 PM Jeremy Payne <jp...@gmail.com> wrote:
>
> pulled the below lua from my work notes..
>
> ++
> function send_request()
>     ts.server_request.header['Host'] = "real-origin.fqdn.com"
> end
>
> function do_remap()
>
> -- this is what i use to segment various file types to different volumes
> -- but will work to separate volumes using the same remap fqdns but
> different paths
> -- enabling pristine is required
>
>     ts.http.config_int_set(TS_LUA_CONFIG_URL_REMAP_PRISTINE_HOST_HDR, 1)
>     ts.client_request.header['Host'] = "live.fqdn.com"
>
> -- restore origin HOST header
>
>     ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)
>     return 0
>
>
> end
>
> On Sun, Jan 12, 2020 at 12:52 PM Leif Hedstrom <zw...@apache.org> wrote:
> >
> >
> >
> > On Jan 12, 2020, at 10:47, Jeremy Payne <jp...@gmail.com> wrote:
> >
> > 
> > Probably the easiest solution is to create another origin fqdn for your live or vod content.
> > Then have the corresponding remap use that new fqdn as your origin fqdn
> > If you cant do that then there are some tricks you can play with the origin
> >
> >
> > Yes. This is the best solution IMO, and if the origin can’t handle the new Host, you could add a header_rewrite rule on the outbound request to restore the Host as they need it.
> >
> > Kind of feels that we ought to add hosting APIs, maybe in addition/together with the new parent policy stuff. Vijay and Rushford, what do you think ?
> >
> > Cheers,
> >
> > parameters that determine which volume to use. I'm not at my desk right now, so when I return I'll look.
> > And as always, there may be some new plugins or new core functionality that I am not aware of that support this without the DNS or origin trickery.
> >
> > On Sun, Jan 12, 2020, 10:57 AM ezko <er...@harmonicinc.com> wrote:
> >>
> >> Hi,
> >> we are using ATS 8.0.5
> >> we have an origin which serves both live and VOD (different paths) , and
> >> would like to cache live on block RAM disk and VOD on SSD
> >>
> >> example origin urls:
> >> http://origin.mydomain.com/live
> >> http://origin.mydomain.com/vod
> >>
> >> from the DOCS it doesn't seem like there is support for specifying paths in
> >> hosting.config
> >> so the following will not work right ?
> >>
> >> hostname=origin.mydomain.com/live volume=1
> >> hostname=origin.mydomain.com/vod volume=2
> >>
> >> is there another way (maybe using a plugin) ?
> >>
> >> BR,
> >> erez
> >>
> >>
> >>
> >>
> >> --
> >> Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by Jeremy Payne <jp...@gmail.com>.
pulled the below lua from my work notes..

++
function send_request()
    ts.server_request.header['Host'] = "real-origin.fqdn.com"
end

function do_remap()

-- this is what i use to segment various file types to different volumes
-- but will work to separate volumes using the same remap fqdns but
different paths
-- enabling pristine is required

    ts.http.config_int_set(TS_LUA_CONFIG_URL_REMAP_PRISTINE_HOST_HDR, 1)
    ts.client_request.header['Host'] = "live.fqdn.com"

-- restore origin HOST header

    ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request)
    return 0


end

On Sun, Jan 12, 2020 at 12:52 PM Leif Hedstrom <zw...@apache.org> wrote:
>
>
>
> On Jan 12, 2020, at 10:47, Jeremy Payne <jp...@gmail.com> wrote:
>
> 
> Probably the easiest solution is to create another origin fqdn for your live or vod content.
> Then have the corresponding remap use that new fqdn as your origin fqdn
> If you cant do that then there are some tricks you can play with the origin
>
>
> Yes. This is the best solution IMO, and if the origin can’t handle the new Host, you could add a header_rewrite rule on the outbound request to restore the Host as they need it.
>
> Kind of feels that we ought to add hosting APIs, maybe in addition/together with the new parent policy stuff. Vijay and Rushford, what do you think ?
>
> Cheers,
>
> parameters that determine which volume to use. I'm not at my desk right now, so when I return I'll look.
> And as always, there may be some new plugins or new core functionality that I am not aware of that support this without the DNS or origin trickery.
>
> On Sun, Jan 12, 2020, 10:57 AM ezko <er...@harmonicinc.com> wrote:
>>
>> Hi,
>> we are using ATS 8.0.5
>> we have an origin which serves both live and VOD (different paths) , and
>> would like to cache live on block RAM disk and VOD on SSD
>>
>> example origin urls:
>> http://origin.mydomain.com/live
>> http://origin.mydomain.com/vod
>>
>> from the DOCS it doesn't seem like there is support for specifying paths in
>> hosting.config
>> so the following will not work right ?
>>
>> hostname=origin.mydomain.com/live volume=1
>> hostname=origin.mydomain.com/vod volume=2
>>
>> is there another way (maybe using a plugin) ?
>>
>> BR,
>> erez
>>
>>
>>
>>
>> --
>> Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by Leif Hedstrom <zw...@apache.org>.

> On Jan 12, 2020, at 10:47, Jeremy Payne <jp...@gmail.com> wrote:
> 
> 
> Probably the easiest solution is to create another origin fqdn for your live or vod content. 
> Then have the corresponding remap use that new fqdn as your origin fqdn
> If you cant do that then there are some tricks you can play with the origin

Yes. This is the best solution IMO, and if the origin can’t handle the new Host, you could add a header_rewrite rule on the outbound request to restore the Host as they need it.

Kind of feels that we ought to add hosting APIs, maybe in addition/together with the new parent policy stuff. Vijay and Rushford, what do you think ?

Cheers,

> parameters that determine which volume to use. I'm not at my desk right now, so when I return I'll look. 
> And as always, there may be some new plugins or new core functionality that I am not aware of that support this without the DNS or origin trickery. 
> 
>> On Sun, Jan 12, 2020, 10:57 AM ezko <er...@harmonicinc.com> wrote:
>> Hi,
>> we are using ATS 8.0.5
>> we have an origin which serves both live and VOD (different paths) , and
>> would like to cache live on block RAM disk and VOD on SSD
>> 
>> example origin urls:
>> http://origin.mydomain.com/live
>> http://origin.mydomain.com/vod
>> 
>> from the DOCS it doesn't seem like there is support for specifying paths in
>> hosting.config 
>> so the following will not work right ?
>> 
>> hostname=origin.mydomain.com/live volume=1
>> hostname=origin.mydomain.com/vod volume=2
>> 
>> is there another way (maybe using a plugin) ?
>> 
>> BR,
>> erez
>> 
>> 
>> 
>> 
>> --
>> Sent from: http://apache-traffic-server.24303.n7.nabble.com/

Re: path based hosting.config

Posted by Jeremy Payne <jp...@gmail.com>.
Probably the easiest solution is to create another origin fqdn for your
live or vod content.
Then have the corresponding remap use that new fqdn as your origin fqdn
If you cant do that then there are some tricks you can play with the origin
parameters that determine which volume to use. I'm not at my desk right
now, so when I return I'll look.
And as always, there may be some new plugins or new core functionality that
I am not aware of that support this without the DNS or origin trickery.

On Sun, Jan 12, 2020, 10:57 AM ezko <er...@harmonicinc.com> wrote:

> Hi,
> we are using ATS 8.0.5
> we have an origin which serves both live and VOD (different paths) , and
> would like to cache live on block RAM disk and VOD on SSD
>
> example origin urls:
> http://origin.mydomain.com/live
> http://origin.mydomain.com/vod
>
> from the DOCS it doesn't seem like there is support for specifying paths in
> hosting.config
> so the following will not work right ?
>
> hostname=origin.mydomain.com/live volume=1
> hostname=origin.mydomain.com/vod volume=2
>
> is there another way (maybe using a plugin) ?
>
> BR,
> erez
>
>
>
>
> --
> Sent from: http://apache-traffic-server.24303.n7.nabble.com/
>