How to send "Cache-Control: no-cache" header in Piwik API responses


I have a Piwik install sitting behind a varnish-caching server. My problem is varnish is by default caching responses to my API calls. Unfortunately, I don’t have direct access to the varnish server, so I need to send the

“Cache-Control: no-cache”

header with my API responses. Is there a setting or a way to modify my piwik install to accomplish this? Thanks!

(vipsoft) #2

We’re already doing this.


That’s weird then. I’m using PHPFog for my hosting and they provide a varnish caching server for every application that’s hosted with them. Normally it works pretty well, but I’m seeing my Piwik API requests getting cached for some reason.

The documentation my hosting provider has states:

[b]"To prevent caching set the “Cache-Control” header to “no-cache”. This is generally required in applications which don’t produce/consume cookies, but have contents that is actually dynamic. Here is the PHP example to set the Cache-Control header.

header(“Cache-Control: no-cache”);"[/b]

But if Piwik is already sending this header, why is Varnish caching my requests? I’ve attached a screenshot of what I’m seeing.

(Matthieu Aubry) #4

I don’t see the http header in the response from neither.

Maybe we don’t currently add this in APi responses?