From ce9f7bcaf63d94a9c792ca9e61cbc10756cf3e66 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 6 Feb 2023 14:53:42 +0000 Subject: [PATCH] add cacher for proxy files --- p/server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/p/server.js b/p/server.js index 0099aa03..70552243 100644 --- a/p/server.js +++ b/p/server.js @@ -22,7 +22,7 @@ const URL_WHITELIST = [ "is3-ssl.mzstatic.com", "twemoji.maxcdn.com", "unpkg.com", - "youtube.com" + "youtube.com", ]; const app = express(); @@ -37,6 +37,9 @@ app.use(function (req, res, next) { app.use(function (req, res, next) { res.header("Access-Control-Allow-Origin", "*"); + res.setHeader("Cache-Control", "public, max-age=870"); // cache header + res.setHeader("poketube-cacher", "PROXY_FILES"); + next(); }); @@ -68,7 +71,6 @@ const proxy = async (req, res) => { }); f.body.pipe(res); - } catch (e) { console.log(`==> Error: ${e}`); res.status(500).send("Internal server error");