Skip to content

Commit

Permalink
Bypass cache authorization header
Browse files Browse the repository at this point in the history
  • Loading branch information
tm-kn committed Feb 3, 2021
1 parent 22f36a2 commit 8076cda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common-caching.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ function requestIsCachable(request) {
if (hasPrivateCookie(request)) {
return false;
}
if (hasAuthorizationHeader(request)) {
return false;
}
return true;
}

Expand All @@ -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;
Expand Down

0 comments on commit 8076cda

Please sign in to comment.