Yep, that's why it would be baked in at the CDN layer with varnish cache, basically at the edge cache, the request would be aware of your settings via cookies and serve the page based on that info. Every time you do this, you split the requests and end up with fewer cache hits, but anything that affects all users like this is fine. If it was thousands of individual configurations, it wouldn't work. But shared configurations like this are perfectly suitable for this approach.
It's technically pretty straightforward, but it's definitely not as simple as if we weren't edge-caching like this.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.