Using http-proxy-middleware (which uses http-proxy) I was able to create proxy to an internal (hidden from outside) url and get expected response.
However, since this is middleware approach, I am not able to apply any existing Guards (eg, JWT, Role etc) to this proxy.
NetJS Guards documentation mentions that Guards are run after each middleware.
Without re-implementing all the Guards as middleware, is there any way that I can protect this proxy route with existing Guards?
Thanks in advance.
It wouldn't be possible to use Nest guards, as you said, this is a middleware. The only thing you could do to protect the proxy route is to add a middleware for the proxy route before the proxy middleware is installed. If you're setting up the proxy middleware in
main.ts
it would look something like this