http-proxy-middleware icon indicating copy to clipboard operation
http-proxy-middleware copied to clipboard

Provide possibility to influence proxy options during req processing

Open oklemenz2 opened this issue 7 months ago • 0 comments

Describe the feature you'd love to see

Currently for example the http(s) agent can only be set statically when instantiating the http proxy middleware. In some situations the options need to be influenced dynamically for each request processing in httpProxy.

Therefore, it would be good to have a possibility adjust the newProxyOptions before they are passed on to httpProxy. Currently the function prepareProxyRequest is private, so there seems to be no official way to do this.

Solution: Allow to pass a callback hook in options, to adjust newProxyOptions, e.g. setting the http(s) agent before the options are passed on to this.proxy.web

Additional context (optional)

No response

oklemenz2 avatar Jun 27 '25 13:06 oklemenz2