- Notifications
You must be signed in to change notification settings - Fork 84
Description
Hi all,
I am using Varnish 4.1.10 with Symfony 3.4.13 and PHP 7.1.16 in backend application, I have FOSHttpCacheBundle ^2.4@dev in my composer.json. I have configured user context based caching using purgekeys tag mode.
I have used user role from our application to identify the user context, which makes one cached resource per role.
As per my understanding, when I open a page as User1 for the first time, the page gets cached and returned from Varnish for the subsequent hits, this is working as expected as long as I am on same session, but the moment I logout and login, my immediate request is not returned from cache and served from a backend fetch.
After seeing the logs in varnish, I could see couple of BAN requests which were actually banning the content from being served from cache. And for the URL I hit, I see a cache miss saying ExpBan nnn banned lookup. I tried commenting out the code from fos_ban_recv subroutine from fos_ban.vcl and now I see cached pages served from varnish even after multiple sessions (logout/login). I do understand that these changes will impact the BAN functionality, but for now I just tried.
My configurations in config.yml
fos_http_cache: user_context: enabled: true cache_manager: enabled: true tags: expression_language: my.expression_language enabled: true rules: - match: path: myPage tag_expressions: ["'myPage-'~id"] proxy_client: varnish: tags_header: xkey-purge tag_mode: purgekeys header_length: 7500 http: servers: - %fos_varnish_http_server% base_url: %fos_varnish_base_uri% invalidation: enabled: true Now what I don't understand is the triggering point of those BAN request. The request from the logs look like the below,
`
Begin req 229407 rxreq
- Timestamp Start: 1537183847.830529 0.000000 0.000000
- Timestamp Req: 1537183847.830529 0.000000 0.000000
- ReqMethod BAN
- ReqURL /
- ReqProtocol HTTP/1.1
- ReqHeader X-Host: .*
- ReqHeader X-Url: .*
- ReqHeader X-Content-Type: .*
`
Could someone assist me with this on identifying the source of the BAN requests.
Please let me know if you need any information/logs.
Thanks!