Exclude auth endpoints from ETag cache
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Roman
2026-06-26 17:35:46 +02:00
parent 52a567df3e
commit b4257f2efa
+10 -1
View File
@@ -1,5 +1,8 @@
# middleware/etag_cache.py
import hashlib, json, time
import hashlib
import json
import time
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import Response
@@ -22,6 +25,12 @@ class ETagCacheMiddleware(BaseHTTPMiddleware):
if request.method != "GET":
return await call_next(request)
if request.url.path.startswith(("/api/auth", "/api/accounts")):
return await call_next(request)
if request.headers.get("authorization"):
return await call_next(request)
key = self._cache_key(request)
entry = self.cache.get(key)
client_etag = request.headers.get("if-none-match")