开发者

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 c开发者_运维问答aching 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!


Add to .htaccess in your piwik install, core/API/ folder:

<Files Request.php>
  Header set Cache-Control "no-cache"
</Files>

If you need to add the header to other URLs, follow the same pattern.

Note that Piwik already adds Cache-Control: max-age=0 to these responses, so if that's not working for you on the Request.php path you probably want to add this to .htaccess in the folder with piwik.js (root of piwik install) as well:

<Files piwik.php>
  Header set Cache-Control "no-cache"
</Files>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜