Open
Description
Checks
- I understand project setup issues should be asked on StackOverflow or in GitHub Discussions.
- I updated to latest
http-proxy-middleware
.
Describe the bug (be clear and concise)
function copyHeaders: RegEx for Domain=*; matches only the first character not the whole domain for example Domain=example.com; replaces strips Domain=e but leaves xample.com
Step-by-step reproduction instructions
Using the request interceptor
Expected behavior (be clear and concise)
to strip the entire Domain=*;
How is http-proxy-middleware used in your project?
Proxying things
What http-proxy-middleware configuration are you using?
export const proxyConfig = createProxyMiddleware({
target,
changeOrigin: false,
selfHandleResponse: true,
on: {
proxyRes: responseInterceptor(
async (responseBuffer, proxyRes, req, res) => {
let response = responseBuffer.toString("utf8");
// Return
return response;
}
),
},
});
What OS/version and node/version are you seeing the problem?
MacOS
Additional context (optional)
keys.forEach((key) => {
let value = originalResponse.headers[key];
if (key === "set-cookie") {
// remove cookie domain
value = Array.isArray(value) ? value : [value];
value = value
.map((x) => x.replace(/Domain=[^;]+;?/i, "")
.replace(/\s+/g, " "));
}
response.setHeader(key, value);
});
Metadata
Metadata
Assignees
Labels
No labels