Closed asheroto closed 2 years ago
Modification of response bodies is far beyond the scope of this library and not supported.
cors-anywhere currently uses a specific version of http-proxy, where the selfHandleResponse
option is not supported. If you'd like to use a library to help with proxying, it would be easier to use the underlying http-proxy library directly (i.e. https://github.com/http-party/node-http-proxy) and add CORS headers when needed, rather than trying to build on top of this one.
Thank you.
Hi there,
Thanks for the great tool! I'm searching for a way to modify the response body of a proxied request. I understand you can specify httpProxyOptions.
Where exactly should I specify/place the code mentioned for cors-anywhere using the modify body technique? I tried doing...
after
}).listen(port, host, function
but I'm not strong enough with JS to understand what to do here. Thanks for your help and patience with this.Or can I somehow modify
cors_proxy.createServer
to use the traditional function method such as...And modify the body via response there?
I saw [https://github.com/http-party/node-http-proxy/blob/master/examples/middleware/bodyDecoder-middleware.js](this example) but am unsure how to utilize it and cors_proxy.
Thank you, I am grateful for your time. :-)