For example:
proxy_cache_key $request_uri$cookie_foo $request_uri: / $cookie_foo: foo => /foo $request_uri: /foo $cookie_foo: '' => /foo As a result, we get two identical keys for completely different requests. The task is to isolate the components of the key by 100% in order not to think at all that they can mix.
The use of a space (which, by the way, are cut out with empty values, which confuses everything even more), another character or string as a separator is 100% such matches do not exclude. Only if you do not generate such a boundary at every request and make sure that it is not present in every component of the key ...
"${request_uri}:::${cookie_foo}"- nörbörnënreq=${request_uri}, cookie=${cookie_foo}- nörbörnën|. In fact, the separator may be present in the key component elements, but in order to avoid generating identical keys for different requests, separators should not occur in an arbitrary number at the ends of at least two adjacent key elements (or elements between which empty values are possible). - Maxim Yaskov