prevents leaking headers to upstream API when serving via Tailscale

This commit is contained in:
nai-degen 2024-05-01 11:26:15 -05:00
parent b1062dc9b3
commit d3e7ef3c14
1 changed files with 6 additions and 1 deletions

View File

@ -7,10 +7,15 @@ import { HPMRequestCallback } from "../index";
export const stripHeaders: HPMRequestCallback = (proxyReq) => {
proxyReq.setHeader("origin", "");
proxyReq.setHeader("referer", "");
proxyReq.removeHeader("tailscale-user-login");
proxyReq.removeHeader("tailscale-user-name");
proxyReq.removeHeader("tailscale-headers-info");
proxyReq.removeHeader("tailscale-user-profile-pic")
proxyReq.removeHeader("cf-connecting-ip");
proxyReq.removeHeader("forwarded");
proxyReq.removeHeader("true-client-ip");
proxyReq.removeHeader("x-forwarded-for");
proxyReq.removeHeader("x-forwarded-host");
proxyReq.removeHeader("x-forwarded-proto");
proxyReq.removeHeader("x-real-ip");
};