mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 11:37:21 -06:00
Fixes #12760 - Adds Vary header to cause cache to be keyed based on URL and the HX-Request header (or lack thereof)
This commit is contained in:
parent
3754e00ee0
commit
f69d99ea67
@ -49,6 +49,9 @@ class CoreMiddleware:
|
|||||||
# Attach the unique request ID as an HTTP header.
|
# Attach the unique request ID as an HTTP header.
|
||||||
response['X-Request-ID'] = request.id
|
response['X-Request-ID'] = request.id
|
||||||
|
|
||||||
|
# Enable the Vary header to help with caching of HTMX responses
|
||||||
|
response['Vary'] = 'HX-Request'
|
||||||
|
|
||||||
# If this is an API request, attach an HTTP header annotating the API version (e.g. '3.5').
|
# If this is an API request, attach an HTTP header annotating the API version (e.g. '3.5').
|
||||||
if is_api_request(request):
|
if is_api_request(request):
|
||||||
response['API-Version'] = settings.REST_FRAMEWORK_VERSION
|
response['API-Version'] = settings.REST_FRAMEWORK_VERSION
|
||||||
|
Loading…
Reference in New Issue
Block a user