config: Update server URLs to use HTTPS for secure connections
All checks were successful
build-and-deploy / filter (push) Successful in 2s
build-and-deploy / build (push) Successful in 9s
build-and-deploy / deploy (push) Successful in 10s

- Change SERVER_URL from http:// to https:// in docker-compose
- Add WebSocket URL conversion logic (https:// → wss://, http:// → ws://)
- Resolves Mixed Content security error when client is served over HTTPS
- Ensures secure communication between client and server
This commit is contained in:
2025-07-05 16:20:33 -06:00
parent 067859e458
commit 660bc3455e
2 changed files with 10 additions and 3 deletions

View File

@@ -29,7 +29,14 @@ export class GameClient {
// Fetch runtime configuration from our Express server
const configResponse = await fetch('/api/config')
const config = await configResponse.json()
const serverUrl = config.serverUrl || 'ws://localhost:2567'
let serverUrl = config.serverUrl || 'ws://localhost:2567'
// Convert HTTP/HTTPS URLs to WebSocket URLs
if (serverUrl.startsWith('https://')) {
serverUrl = serverUrl.replace('https://', 'wss://')
} else if (serverUrl.startsWith('http://')) {
serverUrl = serverUrl.replace('http://', 'ws://')
}
this.client = new Client(serverUrl)
logger.info('Game client initialized with server:', serverUrl)