[INVALID] Cache the .js file for better load


(alpha_one_x86) #1

Hello, I have create this file:
piwik-perso.php
With this content:

<?php
header('Content-Type: application/x-javascript');
header('Last-Modified: '.date(DATE_RFC822,filemtime('piwik.js')));
header('Expires: '.date(DATE_RFC822,time()+3600*24));
header('Cache-Control: store');
readfile('piwik.js');
?>

That’s force to cache one day on piwik.js, it’s usefull for remove multiple .js access especially if the .js in on other host. That’s improve too the load of the tracking server.


(vipsoft) #2

piwik.js is a static file served directly by the web server.

This is probably a wontfix as caching would prevent clients from receiving an updated piwik.js – a bad thing if there are protocol changes.

You might consider using piwik/js/index.php which supports if-modified-since.