Proxy server not getting hit through API gateway

39 Views Asked by At

In my code I am using API Gateway and creating proxy-middleware for microservices. The individual microservices are working fine but when I am delegating the requests to these microservices through an API gateway, its not working. The proxies are getting created.

const {createProxyMiddleware}  = require('http-proxy-middleware');

app.use('/authservice',createProxyMiddleware({target:'http://localhost:3001',changeOrigin:true}));

app.use('/flightservice',createProxyMiddleware({target:'http://localhost:3000',changeOrigin:true}));

the proxies are created as follows:

[HPM] Proxy created: /  -> http://localhost:3001
[HPM] Proxy created: /  -> http://localhost:3000
[HPM] Proxy created: /  -> http://localhost:3002

I even tried requiring createProxyMiddleware without braces but it didn't work.

0

There are 0 best solutions below