CachingResourceResolver + GzipResourceResolver caches different results depending on what is requested first [SPR-12892] #17491
I've configured a resource handler as below:
When requesting a resource from the server using curl, adding the "Accept-Encoding: gzip" header (using curl's --compressed flag), the GzipResourceResolver finds a .gz resource and returns it:
If I then request the same resource without the "Accept-Encoding: gzip" header, the gzipped version is still returned, as it is cached by the CachingResourceResolver:
If I restart the server and first call curl without the "Accept-Encoding: gzip" header, the non gzipped version is returned.
Then requesting the resource with the header still returns the non gzipped version.
To summarise, the server returns different results for the same request, depending on the request headers in the first request for the resource. This is because the CachingResourceResolver caches the resource only using the requestPath as the key, ignoring request headers.
Is this expected behaviour?