Opened 5 years ago

Closed 5 years ago

#646 closed Bug (fixed)

Cache headers should be set explicitly

Reported by: kolchak Owned by:
Priority: normal Milestone: Piwik 0.6.1
Component: Core Keywords:
Cc: Sensitive:

Description

One thing that would be important to ensure accurate numbers is making sure the tracking image isn't cached. We should send back the following headers:

Cache-Control: private, no-cache, proxy-revalidate
Pragma: no-cache

So in core/Tracker.php, maybe do something like:

protected function outputTransparentGif()
{

if( !isset($GLOBALSDEBUGPIWIK?)
!$GLOBALSDEBUGPIWIK? )

{

$trans_gif_64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
header("Content-type: image/gif");
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, proxy-revalidate');
print(base64_decode($trans_gif_64));

}

}

Change History (3)

comment:1 Changed 5 years ago by vipsoft (robocoder)

  • Milestone set to DigitalVibes
  • Priority changed from major to normal

PHP ships with the default headers to not cache.

I agree we should probably set these headers explicitly (instead of assuming the default php configuration).

comment:2 Changed 5 years ago by vipsoft (robocoder)

  • Summary changed from Cache headers to Cache headers should be set explicitly

comment:3 Changed 5 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [1071]) Fixes #646, setting cache headers explicitly to nocache instead of
assuming PHP default.

Note: See TracTickets for help on using tickets.