From f9b2786214d9071532b0fe63cc0b4c0c1e1cb945 Mon Sep 17 00:00:00 2001 From: Tomasz Knapik Date: Wed, 3 Feb 2021 11:48:56 +0000 Subject: [PATCH] Bypass cache authorization header --- common-caching.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common-caching.js b/common-caching.js index b58247f..4318a37 100644 --- a/common-caching.js +++ b/common-caching.js @@ -61,6 +61,9 @@ function requestIsCachable(request) { if (hasPrivateCookie(request)) { return false; } + if (hasAuthorizationHeader(request)) { + return false; + } return true; } @@ -75,6 +78,10 @@ function hasPrivateCookie(request) { ); } +function hasAuthorizationHeader(request) { + return request.headers.has("Authorization"); +} + function responseIsCachable(response) { if (!CACHABLE_HTTP_STATUS_CODES.includes(response.statusCode)) { return false;