From 0af2045548fedf79c68c3f2cded7d88c40b236ef Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Tue, 7 Jan 2025 12:19:30 -0500 Subject: [PATCH] fix(proxy): set `content-type` header from `proxyRequest` variable --- src/proxy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/proxy.ts b/src/proxy.ts index bea8ed0..95cd859 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -6,7 +6,7 @@ const app = fastify(); app.all( "/*", { constraints: { host: new RegExp(`.*\.${process.env.PROXY_DOMAIN}`) } }, - async (req) => { + async (req, reply) => { const subdomains = req.headers.host.split("."); const port = subdomains[0].startsWith("port-") @@ -24,6 +24,8 @@ app.all( }); const proxyResponse = await proxyRequest.text(); + reply.header("content-type", proxyRequest.headers.get("content-type")); + return proxyResponse; }, );