Skip to content

Commit

Permalink
fix(core): use existing upstream Cache-Control if present on upstre…
Browse files Browse the repository at this point in the history
…am response (#2322)
  • Loading branch information
J3tto committed Jan 31, 2022
1 parent ca7f7f7 commit 4f93ea7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/libs/core/src/images/imageOptimizer.ts
Expand Up @@ -257,6 +257,12 @@ export async function imageOptimizer(
upstreamBuffer = Buffer.from(await upstreamRes.arrayBuffer());
upstreamType = upstreamRes.headers.get("Content-Type") ?? undefined;
maxAge = getMaxAge(upstreamRes.headers.get("Cache-Control") ?? undefined);
if (upstreamRes.headers.get("Cache-Control")) {
res.setHeader(
"Cache-Control",
upstreamRes.headers.get("Cache-Control") as string
);
}
} else {
let objectKey;
try {
Expand Down

0 comments on commit 4f93ea7

Please sign in to comment.