{"action":"created","issue":{"url":"https://api.github.com/repos/cachethq/Cachet/issues/553","labels_url":"https://api.github.com/repos/cachethq/Cachet/issues/553/labels{/name}","comments_url":"https://api.github.com/repos/cachethq/Cachet/issues/553/comments","events_url":"https://api.github.com/repos/cachethq/Cachet/issues/553/events","html_url":"https://github.com/cachethq/Cachet/issues/553","id":64813472,"number":553,"title":"make cachet cacheable","user":{"login":"anarcat","id":796623,"avatar_url":"https://avatars.githubusercontent.com/u/796623?v=3","gravatar_id":"","url":"https://api.github.com/users/anarcat","html_url":"https://github.com/anarcat","followers_url":"https://api.github.com/users/anarcat/followers","following_url":"https://api.github.com/users/anarcat/following{/other_user}","gists_url":"https://api.github.com/users/anarcat/gists{/gist_id}","starred_url":"https://api.github.com/users/anarcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anarcat/subscriptions","organizations_url":"https://api.github.com/users/anarcat/orgs","repos_url":"https://api.github.com/users/anarcat/repos","events_url":"https://api.github.com/users/anarcat/events{/privacy}","received_events_url":"https://api.github.com/users/anarcat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cachethq/Cachet/labels/enhancement","name":"enhancement","color":"4B77BE"},{"url":"https://api.github.com/repos/cachethq/Cachet/labels/security","name":"security","color":"674172"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-03-27T17:34:34Z","updated_at":"2015-04-21T05:40:45Z","closed_at":null,"body":"right now, cachet is pretty agressive about tracking users and its content. out of the box, it sets a cookie for every visitor and explicitely forbids caching:\r\n\r\n```\r\nHTTP/1.1 200 OK\r\nDate: Fri, 27 Mar 2015 17:27:50 GMT\r\nServer: Apache/2.2.22 (Debian)\r\nCache-Control: no-cache\r\nSet-Cookie: cachet_session=eyJpdiI6IkxDRTBPdFwvTUpkTHduSzNLUVFYQjVnPT0iLCJ2YWx1ZSI6IkQ4bmFJMTlpWnU0enN4SHBLaG9xMUpIU2M2RXZ5YW45T0FOUGdcL3ZFN3lQK3JjeDZBbHlSd2dsTEdJWVhkYVdLY1l2aDFPQk5IWTJOeEVmVm9MZlFuZz09IiwibWFjIjoiODUyZTRjMTFjMjg4NjE0YzFkZjQyMDExNmM0NWI3Njc1N2U1NGY5Yzk3ZjllNDA5MzkwZjFkMjM4NDVjMTRjOCJ9; expires=Sat, 28-Mar-2015 03:27:52 GMT; path=/; httponly\r\nVary: Accept-Encoding\r\nContent-Type: text/html; charset=UTF-8\r\n```\r\n\r\nThe idea here would be to get rid of the `Set-Cookie` directive and remove the `Cache-control` header, or set it to a good value. Example of a more properly configured site:\r\n\r\n```\r\nHTTP/1.1 200 OK\r\nServer: Apache/2.2.22 (Debian)\r\nCache-Control: public, max-age=3600\r\nLast-Modified: Fri, 27 Mar 2015 16:34:03 +0000\r\nExpires: Sun, 11 Mar 1984 12:00:00 GMT\r\nVary: Cookie,Accept-Encoding\r\nETag: \"1427474043\"\r\nContent-Type: text/html; charset=utf-8\r\nDate: Fri, 27 Mar 2015 17:31:56 GMT\r\nX-Varnish: 691902615 691819374\r\nAge: 3472\r\nVia: 1.1 varnish\r\nConnection: keep-alive\r\n```\r\n\r\nabove, the `Cache-Control` header allows for caching up to 1h, and tells the caching systems that different `Cookie` and `Accept-Encoding` will end up invalidating the cache. You can also notice that Varnish is caching the page properly (`Age: 3472`).\r\n\r\nconsidering Cachet can be used in critical situations with lots of traffic, it would be nice to optimise this in such a way. then Nginx or Varnish could cache the content and serve it without loading the PHP stack at all."},"comment":{"url":"https://api.github.com/repos/cachethq/Cachet/issues/comments/94645672","html_url":"https://github.com/cachethq/Cachet/issues/553#issuecomment-94645672","issue_url":"https://api.github.com/repos/cachethq/Cachet/issues/553","id":94645672,"user":{"login":"wfjsw","id":2220320,"avatar_url":"https://avatars.githubusercontent.com/u/2220320?v=3","gravatar_id":"","url":"https://api.github.com/users/wfjsw","html_url":"https://github.com/wfjsw","followers_url":"https://api.github.com/users/wfjsw/followers","following_url":"https://api.github.com/users/wfjsw/following{/other_user}","gists_url":"https://api.github.com/users/wfjsw/gists{/gist_id}","starred_url":"https://api.github.com/users/wfjsw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wfjsw/subscriptions","organizations_url":"https://api.github.com/users/wfjsw/orgs","repos_url":"https://api.github.com/users/wfjsw/repos","events_url":"https://api.github.com/users/wfjsw/events{/privacy}","received_events_url":"https://api.github.com/users/wfjsw/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T05:40:45Z","updated_at":"2015-04-21T05:40:45Z","body":"You may use \r\n```php\r\nHeader('');\r\n``` \r\n:)"}}