Skip to content

Commit

Permalink
overwrite cache-control header instead of append a new value by makin…
Browse files Browse the repository at this point in the history
…g case identical to what is in the response from CF
  • Loading branch information
Chris Park committed May 13, 2024
1 parent a68b3b7 commit 64449d7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/prerender-proxy/lib/handlers/cache-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ export const handler = async (
const cacheKey = process.env.PRERENDER_CACHE_KEY || "x-prerender-requestid";
const cacheMaxAge = process.env.PRERENDER_CACHE_MAX_AGE || "0";
const response = event.Records[0].cf.response;

if (response.headers[`${cacheKey}`]) {
response.headers["Cache-Control"] = [
response.headers["cache-control"] = [
{
key: "Cache-Control",
value: `max-age=${cacheMaxAge}`,
Expand Down

0 comments on commit 64449d7

Please sign in to comment.