How do I delete headers when using responseInterceptor? #712
Answered
by
chimurai
thealtofwar
asked this question in
Q&A
-
I would like to delete a header from the response of the proxy onProxyRes: responseInterceptor(async (responseBuffer, proxyRes, req, res) => {
const response = responseBuffer.toString('utf8');
delete proxyRes.headers["Content-Security-Policy"];
return response.replaceAll('//' + proxySite, '//' + hostName).replaceAll("//" + proxyCDN, "//" + hostCDN);
} However the proxy still sends the CSP. ~$ curl --head localhost:3000
HTTP/1.1 200 OK
some headers ommitted ...
content-security-policy: default-src 'self'; image-src: 'self' https://thirdpartycdn.com |
Beta Was this translation helpful? Give feedback.
Answered by
chimurai
Apr 11, 2022
Replies: 2 comments
-
It's document here: Credits go to @stefanwright1988 for updating the docs (#724) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
chimurai
-
Y como pudiera eliminar un encabezado en el onProxyReq?....porque solo me deja modificarlo pero no eliminar. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's document here:
https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/response-interceptor.md#manipulate-response-headers
Credits go to @stefanwright1988 for updating the docs (#724)