shreemaan-abhishek opened a new pull request, #13376:
URL: https://github.com/apache/apisix/pull/13376

   ### Description
   
   The memory cache strategy previously ignored the upstream `Vary` response 
header, so requests that differed only in a Vary'd header (e.g. 
`Accept-Encoding`) collided on the same cache entry. The disk strategy already 
inherits Vary handling from NGINX's native `proxy_cache`; this PR brings the 
memory strategy in line.
   
   What changes:
   - Parse the upstream `Vary` header into a canonical sorted list of 
lowercased header names.
   - Store an index entry at `<base_key>::__vary` describing the Vary headers 
and known variants for that base key.
   - Store each variant at `<base_key>::<md5(request values)>`.
   - On lookup, read the index, compute the request's signature, and resolve to 
the matching variant. With no index present, fall back to the base key (no Vary 
recorded).
   - `Vary: *` is treated as not reusable per RFC 9111 §4.1 and is not cached.
   - `PURGE` walks every variant under a base key.
   - `CACHE_VERSION` is bumped from 1 to 2 so any pre-Vary entries get purged 
on read via the existing version-mismatch path.
   
   The disk handler is intentionally unchanged.
   
   #### Which issue(s) this PR fixes:
   Fixes #
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   
   ### Notes
   
   - Integration tests under `t/plugin/proxy-cache/memory.t` were added (TEST 
41–44) but I have not run the suite locally on this branch.
   - The disk cache strategy is unaffected; NGINX's native `proxy_cache` 
already handles `Vary`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to