Reputation: 1892
I am currently working with :
I am trying to access my gateways at the same url using proxy but it does not work. Here is my configuration :
conversation.ts:
socket = io('/service-conversation');
setupProxy.js :
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({
target: 'http://127.0.0.1:8000/api',
})
);
app.use(
'socket.io',
createProxyMiddleware({
target: 'http://127.0.0.1:3000',
ws: true,
})
);
};
gateway.ts :
@WebSocketGateway({
cors: true,
namespace: 'service-conversation',
})
export class ConversationGateway {
@WebSocketServer() webSocketServer: Server;
To give some insight I tried :
socket = io('http://localhost:3000/service-conversation');
it works but as I want it deployed on the same url on prod it is not the right solutioncreateProxyMiddleware('socket.io', {...
Upvotes: 0
Views: 28