aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/image-proxy.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/api/image-proxy.ts b/api/image-proxy.ts
index 3bd88c8..334056d 100644
--- a/api/image-proxy.ts
+++ b/api/image-proxy.ts
@@ -28,6 +28,7 @@ export default async (request: NowRequest, response: NowResponse) => {
if (["image", "video"].includes(res.headers.get("Content-Type").split("/")[0].toLowerCase())) {
response.setHeader("Content-Type", res.headers.get("Content-Type"));
+ response.setHeader("Cache-Control", "s-maxage=86400");
} else if (res.headers.get("Content-Type").toLowerCase() === "application/octet-stream") {
const match = imageURL.match(/\.(\w{3,4})($|\?)/);
if (!match) return response.status(400).send("Error: Cannot determine Content-Type");
@@ -45,6 +46,7 @@ export default async (request: NowRequest, response: NowResponse) => {
}[match[1]];
if (!contentType) return response.status(400).send("Error: Unknown Content-Type");
response.setHeader("Content-Type", contentType);
+ response.setHeader("Cache-Control", "s-maxage=86400");
} else {
return response.status(400).send("Error: Unsupported Content-Type");
}