Active
Project:
Page Cache Vary
Version:
1.0.3
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2025 at 19:48 UTC
Updated:
12 Sep 2025 at 07:47 UTC
Jump to comment: Most recent
My problem is Drupal behind a proxy and I need the vary header to properly set the language.
http-response set-header Vary "Accept-Language, Cookie, Accept-Encoding".
How can I use your code to make that possible?
Thank you?
Comments
Comment #2
elendev commentedI would add a custom CacheContext extending the VaryCacheContextInterface, and provide all the wanted Vary headers through the `getVaryHeaders` method.
If you need Drupal to handle variation, you can also compute all those headers in the `getContext` method.
I would do a custom CacheContext per Vary header though.
You could try to "decorate" the existing CacheContexts (like language, cookie, and so on) and provide a "VaryCacheContextInterface" decorator.
You need to create a custom module in any case.
I hope this helps
Comment #3
maxilein commentedThank you for your help!
Does this look good?