From 811a3d3fce81ca9e22deb3ac21ca31d99037f1ef Mon Sep 17 00:00:00 2001 From: Andrey Ivliev Date: Wed, 17 Feb 2021 16:22:01 +0300 Subject: [PATCH] Skip no string forward headers --- src/proxy.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/proxy.ts b/src/proxy.ts index 77552557..18ff0424 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -22,7 +22,11 @@ export function getProxyExecuteFn(url, headers, forwardHeaders) { const request = contextValue as IncomingMessage; const proxyHeaders = Object.create(null); for (const name of forwardHeaders) { - proxyHeaders[name] = request.headers[name]; + const incomingHeader = request.headers[name]; + + if (typeof incomingHeader === 'string' && incomingHeader.length > 0) { + proxyHeaders[name] = request.headers[name]; + } } const strippedAST = removeUnusedVariables(