{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/19056","labels_url":"https://api.github.com/repos/rails/rails/issues/19056/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/19056/comments","events_url":"https://api.github.com/repos/rails/rails/issues/19056/events","html_url":"https://github.com/rails/rails/issues/19056","id":58688075,"number":19056,"title":"etag_matches? does not work correctly when the tags include the '-gzip' suffix","user":{"login":"ruipgpinheiro","id":11169970,"avatar_url":"https://avatars.githubusercontent.com/u/11169970?v=3","gravatar_id":"","url":"https://api.github.com/users/ruipgpinheiro","html_url":"https://github.com/ruipgpinheiro","followers_url":"https://api.github.com/users/ruipgpinheiro/followers","following_url":"https://api.github.com/users/ruipgpinheiro/following{/other_user}","gists_url":"https://api.github.com/users/ruipgpinheiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ruipgpinheiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruipgpinheiro/subscriptions","organizations_url":"https://api.github.com/users/ruipgpinheiro/orgs","repos_url":"https://api.github.com/users/ruipgpinheiro/repos","events_url":"https://api.github.com/users/ruipgpinheiro/events{/privacy}","received_events_url":"https://api.github.com/users/ruipgpinheiro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-24T03:20:22Z","updated_at":"2015-02-24T04:31:32Z","closed_at":null,"body":"So, I've been trying to figure out why my application running on 4.2 wasn't answering using 304 Not Modified, except in very rare cases, even though the etag and if-modified-since header are correct.\r\n\r\nI keep having situations where Firefox sent the following headers:\r\n> If-Modified-Since\tTue, 24 Feb 2015 02:56:06 GMT\r\n> If-None-Match\t\"d7ce2a284581b0ecbd36707d44647d47-gzip\"\r\n\r\nAnd rails answered with these, and a 200 response (so it was processing the request from scratch):\r\n>Etag\t\"d7ce2a284581b0ecbd36707d44647d47-gzip\"\r\n>Last-Modified\tTue, 24 Feb 2015 02:56:06 GMT\r\n\r\nAs can be seen, both the etag and the modified date match. To be exact, they're *exactly the same*.\r\n\r\nAnd that's the problem - when the browser requests the content the first time, it receives the correct etag and last modified date. On further requests, it sends if-modified-since with the last-modified date it received previously.\r\n\r\nFor some reason, rails is considering that is stale, and processes the request again.\r\n\r\nThe code I'm using (and yes, it is generating dynamic CSS. It works, just not the stale? caching):\r\n\r\n    def shows\r\n        etag = \"#{ current_user.id }\"\r\n        last_modified = current_user.shows_updated_at\r\n\t\r\n        if stale?(etag: etag, last_modified: last_modified)\r\n            respond_to do |format|\r\n                format.css { render :content_type => \"text/css\" }\r\n            end\r\n        end\r\n    end"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/75697931","html_url":"https://github.com/rails/rails/issues/19056#issuecomment-75697931","issue_url":"https://api.github.com/repos/rails/rails/issues/19056","id":75697931,"user":{"login":"ruipgpinheiro","id":11169970,"avatar_url":"https://avatars.githubusercontent.com/u/11169970?v=3","gravatar_id":"","url":"https://api.github.com/users/ruipgpinheiro","html_url":"https://github.com/ruipgpinheiro","followers_url":"https://api.github.com/users/ruipgpinheiro/followers","following_url":"https://api.github.com/users/ruipgpinheiro/following{/other_user}","gists_url":"https://api.github.com/users/ruipgpinheiro/gists{/gist_id}","starred_url":"https://api.github.com/users/ruipgpinheiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ruipgpinheiro/subscriptions","organizations_url":"https://api.github.com/users/ruipgpinheiro/orgs","repos_url":"https://api.github.com/users/ruipgpinheiro/repos","events_url":"https://api.github.com/users/ruipgpinheiro/events{/privacy}","received_events_url":"https://api.github.com/users/ruipgpinheiro/received_events","type":"User","site_admin":false},"created_at":"2015-02-24T04:31:32Z","updated_at":"2015-02-24T04:31:32Z","body":"I'm not sure. The server (I'm running rails 4.2 with Apache and Passenger Phusion) seems to do it. WebBrick doesn't.\r\n\r\nMight have something to do with the fact that I'm rendering CSS? Does Rails/Passenger/Apache compress CSS or something?"}}