fix(proxy): set content-type header from proxyRequest variable

This commit is contained in:
CyberL1 2025-01-07 12:19:30 -05:00
parent 4d661c073c
commit 0af2045548

View File

@ -6,7 +6,7 @@ const app = fastify();
app.all( app.all(
"/*", "/*",
{ constraints: { host: new RegExp(`.*\.${process.env.PROXY_DOMAIN}`) } }, { constraints: { host: new RegExp(`.*\.${process.env.PROXY_DOMAIN}`) } },
async (req) => { async (req, reply) => {
const subdomains = req.headers.host.split("."); const subdomains = req.headers.host.split(".");
const port = subdomains[0].startsWith("port-") const port = subdomains[0].startsWith("port-")
@ -24,6 +24,8 @@ app.all(
}); });
const proxyResponse = await proxyRequest.text(); const proxyResponse = await proxyRequest.text();
reply.header("content-type", proxyRequest.headers.get("content-type"));
return proxyResponse; return proxyResponse;
}, },
); );