Open alpgul opened 2 months ago
if (redirectUrl.protocol !== currentUrlParts.protocol &&
redirectUrl.protocol !== "https:" ||
redirectUrl.host !== currentHost &&
!isSubdomain(redirectUrl.host, currentHost)) {
removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
}
I found the reason for the problem: follow-redirects package is deleting the cookie header.
const proxy = createProxyMiddleware({
ssl: {
beforeRedirect: (options, response, request) => {
options.headers["Cookie"] = 'mycookie=test';
}
}
target: 'https://www.example.com/',
changeOrigin: true,
agent,
autoRewrite: true,
followRedirects: true,
selfHandleResponse: true,
headers: {
"Cookie": "test=123"
},
on: {
proxyReq: (proxyReq, req, res, options) => {
}
}
});
I can send the cookie value to the redirect using the temporary solution above.
Checks
http-proxy-middleware
.Describe the bug (be clear and concise)
The "Cookie" header is not automatically added to the redirected address.
Step-by-step reproduction instructions
Expected behavior (be clear and concise)
The addition of the "Cookie" header to the redirected address.
How is http-proxy-middleware used in your project?
What http-proxy-middleware configuration are you using?
What OS/version and node/version are you seeing the problem?
Additional context (optional)
No response