diff --git a/nginx/conf/locations/ttt.conf b/nginx/conf/locations/ttt.conf new file mode 100644 index 0000000..eee6057 --- /dev/null +++ b/nginx/conf/locations/ttt.conf @@ -0,0 +1,14 @@ +#forward the post request to the microservice +location /api/ttt/ { + proxy_pass http://app-tic-tac-toe; +} + +location /api/ttt/socket.io/ { + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + proxy_read_timeout 3600s; + proxy_pass http://app-tic-tac-toe; +} diff --git a/src/tic-tac-toe/src/plugins/socket.ts b/src/tic-tac-toe/src/plugins/socket.ts index f32dec8..f485775 100644 --- a/src/tic-tac-toe/src/plugins/socket.ts +++ b/src/tic-tac-toe/src/plugins/socket.ts @@ -18,7 +18,7 @@ const fastifySocketIO: FastifyPluginAsync = fp(async (fastify) => { } fastify.decorate( 'io', - new Server(fastify.server, { path: '/api/chat/socket.io' }), + new Server(fastify.server, { path: '/api/ttt/socket.io' }), ); fastify.addHook('preClose', defaultPreClose); fastify.addHook('onClose', (instance: FastifyInstance, done) => {