From f3d136558826fa77cd74160c76e122e88cbb1eaf Mon Sep 17 00:00:00 2001 From: josedario87 Date: Sat, 5 Jul 2025 16:43:29 -0600 Subject: [PATCH] fix: Separate internal and external server URLs for SSL compatibility - Add PUBLIC_SERVER_URL environment variable for client-side connections - Update /api/config endpoints to return public HTTPS URLs for frontend - Keep internal HTTP URLs for server-to-server communication - Resolves SSL certificate verification issues in admin service - Maintains secure WSS/HTTPS connections for clients --- admin/server.js | 2 +- client/server.js | 2 +- docker-compose.yml | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/server.js b/admin/server.js index f595492..cf7e1fb 100644 --- a/admin/server.js +++ b/admin/server.js @@ -27,7 +27,7 @@ app.get('/health', (req, res) => { // API endpoint to get environment config for client app.get('/api/config', (req, res) => { res.json({ - serverUrl: process.env.SERVER_URL, + serverUrl: process.env.PUBLIC_SERVER_URL || process.env.SERVER_URL, environment: ENV }); }); diff --git a/client/server.js b/client/server.js index a0d3a68..5d2cb08 100644 --- a/client/server.js +++ b/client/server.js @@ -51,7 +51,7 @@ app.get('/health', (req, res) => { // API endpoint to get environment config for client app.get('/api/config', (req, res) => { res.json({ - serverUrl: process.env.SERVER_URL, + serverUrl: process.env.PUBLIC_SERVER_URL || process.env.SERVER_URL, environment: ENV }); }); diff --git a/docker-compose.yml b/docker-compose.yml index 4115fca..1122a9e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,8 @@ services: environment: - NODE_ENV=production - PORT=3000 - - SERVER_URL=https://snatchGameServer.interno.com + - SERVER_URL=http://snatchgame-server:2567 + - PUBLIC_SERVER_URL=https://snatchGameServer.interno.com depends_on: - snatchgame-server networks: @@ -53,7 +54,8 @@ services: environment: - NODE_ENV=production - PORT=3001 - - SERVER_URL=https://snatchGameServer.interno.com + - SERVER_URL=http://snatchgame-server:2567 + - PUBLIC_SERVER_URL=https://snatchGameServer.interno.com depends_on: - snatchgame-server networks: