{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/371","repository_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/371/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/371/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/371/events","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/371","id":236664902,"number":371,"title":"X-User-Context-Hash header is not set","user":{"login":"spointecker","id":8910787,"avatar_url":"https://avatars3.githubusercontent.com/u/8910787?v=3","gravatar_id":"","url":"https://api.github.com/users/spointecker","html_url":"https://github.com/spointecker","followers_url":"https://api.github.com/users/spointecker/followers","following_url":"https://api.github.com/users/spointecker/following{/other_user}","gists_url":"https://api.github.com/users/spointecker/gists{/gist_id}","starred_url":"https://api.github.com/users/spointecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spointecker/subscriptions","organizations_url":"https://api.github.com/users/spointecker/orgs","repos_url":"https://api.github.com/users/spointecker/repos","events_url":"https://api.github.com/users/spointecker/events{/privacy}","received_events_url":"https://api.github.com/users/spointecker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-06-17T14:53:13Z","updated_at":"2017-07-13T08:57:37Z","closed_at":null,"body":"Hi,\r\n\r\nI am trying to implement the cache only for logged out users but I have some problems getting there.\r\nFirst of all: Is there a full example of implementing such a setting?\r\n\r\nI never have a `X-User-Context-Hash` header in my response. Also if I use the role provider. (I cleared the caches every time I changed the config)\r\n\r\nMy setting so far:\r\n- Using v2.0.*\r\n- Implemented custom context `IsAuthenticatedProvider`\r\n- Added the provider to my service configuration\r\n- Extended the `security.yml` like the documentation said (added `_fos_user_context_hash` to access control)\r\n- Added `RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]` to my `.htaccess`\r\n- Current config:\r\n```\r\nfos_http_cache:\r\n    user_context:\r\n        hash_cache_ttl: 3600\r\n        enabled: true\r\n\r\n    cache_control:\r\n        defaults:\r\n            overwrite: true\r\n\r\n        rules:\r\n            # match index\r\n            -\r\n                match:\r\n                    path: ^/$\r\n                headers:\r\n                    cache_control: { public: true, private: false, max_age: 86400, s_maxage: 86400 }\r\n                    etag: true\r\n```\r\nOne more thing: I have also a problem with the authentication context in my custom context provider:\r\nIf I want to check if the user is logged in (like in the documentation) it says, that there is no authentication token set -> but I added the access rule like in the documentation said (see http://foshttpcachebundle.readthedocs.io/en/stable/features/user-context.html) \r\nbut even if I just set a random value for the context like this, the header is missing.\r\n```\r\npublic function updateUserContext(UserContext $userContext)\r\n    {\r\n        $userContext->addParameter('authenticated', 'test');\r\n    }\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/comments/315016581","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/371#issuecomment-315016581","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/371","id":315016581,"user":{"login":"dbu","id":76576,"avatar_url":"https://avatars0.githubusercontent.com/u/76576?v=3","gravatar_id":"","url":"https://api.github.com/users/dbu","html_url":"https://github.com/dbu","followers_url":"https://api.github.com/users/dbu/followers","following_url":"https://api.github.com/users/dbu/following{/other_user}","gists_url":"https://api.github.com/users/dbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbu/subscriptions","organizations_url":"https://api.github.com/users/dbu/orgs","repos_url":"https://api.github.com/users/dbu/repos","events_url":"https://api.github.com/users/dbu/events{/privacy}","received_events_url":"https://api.github.com/users/dbu/received_events","type":"User","site_admin":false},"created_at":"2017-07-13T08:57:37Z","updated_at":"2017-07-13T08:57:37Z","body":"did you look at listener priorities? the lower the number, the later the listener is executed, if i remember correctly. if the listener from the FOSHttpCacheBundle is executed after your listener, it will overwrite the caching with the configured headers. and have you verified your listener is indeed executed? \r\n\r\nto debug, you could hack something into both your and the FOSHttpCacheBundle listener to add each a custom header plus one custom shared header that both write to. in the shared header, you should see that your header wrote last to it."}}
{"actor":{"display_login":"dbu"}}