Re: [squid-users] Caching HLS content?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 01 Feb 2013 18:42:23 +1300

On 1/02/2013 1:30 p.m., Leonardo Rodrigues wrote:
>
> an even better approach would be correctly setup your webserver to
> send the appropriate expire times for the .m3u8 files so your caches
> neither any other one would cache them :)

+1 to that.

> a correctly expire time for the .ts could be sent as well, allowing
> them to be cached
>

The .ts *are* being cached. It is the refresh lookup which the server is
reponding by indicating there has been no change to the .ts object
(UNMODIFIED).

>
> Em 31/01/13 22:19, Scott Baker escreveu:
>> I want to make sure that .m3u8 files are *never* cached. Those files are
>> updated every 5 seconds on my server, and always have the same name.

Which means you should send one or both of:
  * Cache-Control:max-age=5 with Last-Modified header containing the
timestamp the file was last modified.
  * Expires: header with a datestamp 5 seconds since the last time the
file was modified.

>> What is the best way to make sure that they are never cached? This is
>> what I came up with:
>>
>> refresh_pattern \.m3u8 0 0% 0

No. Configuration options inside squid.conf only affect the Squid using
that config file. All other proxies your objects pass through will do
their own thing, *unless* you send HTTP headers to control the object
age and expiry properly as mentioned above.

To cause something never to be cached use Cache-Control:no-store, and/or
a header of Expires:-1

>>
>> Conversely, MPEG segments are .ts files and are ALWAYS the same. The
>> file names roll, so once an mpeg segment is created it will *never* get
>> updated. Thus those files should ALWAYS be cached, and there is no
>> reason to ever refresh the file. How do I ensure that .ts segments are
>> cached, and there is no reason to re-validate them. These pieces of
>> content will expire after 15 minutes (it's live video), so there is no
>> reason to keep any .ts files that are older than 15 minutes. This is
>> what I came up with:
>>
>> refresh_pattern \.ts 900 100% 900
>>
>> Currently I'm seeing a lot of TCP_REFRESH_UNMODIFIED in my logs for .ts
>> segments. I must be doing something wrong.

Squid did a freshness check to see if the object in cache was up to
date. The server replied indicating UNMODIFIED. This is the expected
behaviour when the .ts object has not changed.

Amos
Received on Fri Feb 01 2013 - 05:42:31 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 01 2013 - 12:00:05 MST