I have a RESTful Api written in Symfony2 using FosOauth2Serverbundle, FosRestBundle and FosUserBundle. I am planing to bring varnish in front of my api as reverse proxy. Since my app using my api always send access_token as parameter or header varnish caches almost every request as different requests and it is not effective. Because i use user of access_token in my controller for security and sometimes for content, i can not remove access_token from request completely from request in vcl_recv. After several search on internet, i come across a solution for authentication http://www.adayinthelifeof.nl/2012/07/06/using-varnish-to-offload-and-cache-your-oauth-requests/ . However, i can not figure out how to tell FosUserBundle current user in header to pass security in security.yml:
access_control:
- { path: ^/2013-08-30/foo$, role: ROLE_USER, requires_channel: https, methods: [GET] }
In short, How can i tell FosUserBundle current user in request(send from varnish) header?