httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
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

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

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"


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

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

Kind regards,


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,  <>
>> For additional commands,  <>

View raw message