HTTP response for piwik.js

I’ve noticed that subsequent requests from a (cached) client for piwik.js are served with a 200 OK response (i.e. the full file data is returned every time) rather than a 304 Not Modified. This strikes me as - at best - unusual, as it means a lot of server bandwidth is potentially going to be used serving this file to clients who have a perfectly good copy of it cached.

Is piwik.js a static file? Looking at the source on dev. it looks to be - so that presumably makes this an issue for my server? Or is it dynamically generated by a Piwik PHP script pretending to be a .js?

Unless you’re using the PHP script in piwik/js/index.php, then yes, piwik/piwik.js is a static file and it is served directly by your web server.

One possible explanation is that your browser has caching disabled (e.g., the WebDeveloper extension for Firefox).

No - other cached files from elsewhere are OK, just the piwik.js seems to be coming down. I’ll need to check how other files from that server are handled though, in case it’s server settings on the piwik host machine. I’ll also try changing the tracking code to use that index.php scrip in /js - that looks to do exactly what’s needed, has this problem surfaced before?

*** EDIT ***

Yep, sending the request to /js/index.php instead of letting the server handle the static file request has fixed it - the script responds properly with a 304. Hmmm, that server needs looked at! Thanks for pointing me in the right direction!

Use curl from the shell or the WebDeveloper extension for FF to see the server response header when you GET piwik.js.