we have a Drupal 8 with Cloudflare cache rule. By default we have always GBP currency, then we developed a module that allow users change their currency with a footer dropdown and saves it on the user session.
Without Cloudflare cache rule, the webpage works correctly. The problem is if the rule is active, the first visit to the web is cached with the default currency, then if someone try to change the currency to EUR, the web page is reloaded and it shows the cached page with default currency and not EUR.
Cloudflare cache is by URL and we always keep the same URL for all currencies.
Start Clodflare screeshots
End Clodflare screeshots
A solution that we thought is to add/force the currency as a parameter of the URL.
https://www.amazon.com/
https://www.amazon.com/?currency=EUR&language=es_US
https://www.amazon.com/?currency=EUR&language=en_US
https://www.amazon.com/?currency=USD&language=es_US
Is possible to force a request to have always a param? Is there any way to do this? Like an EventSubscriber?
Thank u all.