echo
echo copied to clipboard
Proxy middleware: add ModifyRequest function to modify http.Request before proxy
The proxy middleware currently does not allow any modification to the request, only ModifyResponse. This PR adds that option so caller can pass a custom function to be applied to requests before it hits reverse proxy.
I have also added passing test.
Please consider merging this as it would allow for more flexibility when proxy with Echo.
Thanks!
@aldas is it possible to modify the proxy target urls at runtime?
I think you are looking for: https://github.com/labstack/echo/blob/4a1ccdfdc520eb90573a97a7d04fd9fc300c1629/middleware/proxy.go#L69 and look how commonBalancer works
@aldas oh so I can use the returned object from NewRoundRobinBalancer to change the proxy targets by calling the appropriate methods?
The interface is already implemented internally? I just have to call addTarget with the right parameter ?