httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "rexkogitans@gmx.at" <rexkogit...@gmx.at>
Subject Re: [users@httpd] caching of HTML5 <video> (MP4)
Date Sun, 16 Jun 2019 10:20:54 GMT
Hello, Norbert,


first of all I want to introduce my situation a bit. I am IT sysadmin at
a telecommunication who is responsible for setting up web servers. We
also have the situation that customers load a site or a part of a site,
say the CSS files or JQuery, a hundred times an hour whice is really not
necessary.

In the view of HTTP, caching is always an advice that is given from the
server to the client. It is the client's responsibility (i.e. its
specific behaviour to follow this advice) to really cache the files and
not re-request them from the server.

In HTTP 1.1, the caching is a simple HTTP header field, see section 14.9
here:

https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

So, for example:

Cache-Control: max-age=3600, public

to advice the client a cache of 3600 seconds. You may want to adjust the
value to your needs.

Since you do not want every file to be cached, you may want to put the
header under a condition:

<FilesMatch "\.mp4$">

Header set Cache-Control "max-age=3600, public"

</FilesMatch>

You can put this into the virtual host configuration file or into the
.htaccess file.The FilesMatch directive is described here:

https://httpd.apache.org/docs/2.4/de/mod/core.html#filesmatch

and the string "\.mp4$" is a Regular Expression to match the file names.


Kind regards,

rexkogitans


Am 16.06.19 um 09:53 schrieb Norbert de Jonge:
> Anyone know a company that I can pay to get solid advice on this?
>
> I mean a company that actually knows what to do in my situation,
> instead of just accepting my money and then using Google/Stack
> Overflow to see what information they can give me.
>
> Best regards,
> Norbert
>
> On Thu, 2019-06-13 at 20:40 +0200, Norbert de Jonge wrote:
>> Hi folks,
>> When I'm serving up many (huge) MP4 files via HTML5 <video>, and want
>> heavy caching to keep traffic down, is the following suitable
>> public_html/.htaccess content?
>> =====
>> <IfModule mod_expires.c>
>> <FilesMatch "\.(mp4)$">
>> ExpiresActive On
>> Header set Expires "Mon, 27 Mar 2038 13:33:37 GMT"
>> </FilesMatch>
>> </IfModule>
>> =====
>> Thanks!
>> Best regards,
>> Norbert
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscribe@httpd.apache.org  <mailto:users-unsubscribe@httpd.apache.org>
>> For additional commands, e-mail:users-help@httpd.apache.org  <mailto:users-help@httpd.apache.org>

Mime
View raw message