mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-11-19 10:55:04 +00:00
fix(cache): honour X-Skip-Cache and Cache-Control no-cache
Clients sent X-Skip-Cache: true or Cache-Control: no-cache on reads that gate money and quotas, but the proxy ignored both and answered from its cache for up to CACHE_TTL seconds. A quota or overage setting change therefore took effect late. A request with either header now goes to the backend, is not stored and does not join an identical request in flight.
This commit is contained in:
@@ -726,7 +726,9 @@ func performProxyRequest(c fiber.Ctx, proxyURL string) error {
|
||||
|
||||
// Check if request coalescing is enabled
|
||||
rc := GetRequestCoalescer()
|
||||
if rc != nil && cfg.RequestCoalescing.Enable {
|
||||
// A cache-bypass read must not join an identical request already in flight:
|
||||
// that one may have started before the write the caller needs to see.
|
||||
if rc != nil && cfg.RequestCoalescing.Enable && !skipCacheRequested(c) {
|
||||
// Use request coalescing to deduplicate identical concurrent requests
|
||||
response, err := rc.Do(cacheKey, func() (*CoalescedResponse, error) {
|
||||
// Execute the actual proxy request
|
||||
|
||||
Reference in New Issue
Block a user