Skip to content

Carry game traffic over the HTTP port; support HTTPS/wss - #35

Merged
treyyoder merged 1 commit into
masterfrom
ws-single-port
Aug 13, 2026
Merged

Carry game traffic over the HTTP port; support HTTPS/wss#35
treyyoder merged 1 commit into
masterfrom
ws-single-port

Conversation

@treyyoder

Copy link
Copy Markdown
Owner

Summary

  • Single-port operation: Apache's mod_proxy_wstunnel now proxies websocket-upgrade requests on port 80 to the internal game server on 27960, so the published HTTP port carries the page, assets, and game connection. The 27960:27960 mapping is gone from compose (publishing it directly remains possible for anything that wants the raw socket).
  • HTTPS/wss support: ioquake3.js is patched at build time — asset URLs become scheme-relative and the game websocket uses wss:// when the page is HTTPS — so the game is fully playable behind a TLS-terminating reverse proxy. Build fails fast (grep guards) if upstream changes make the patches stop matching.
  • Origin-adaptive client: the entrypoint bakes window.location-based expressions into index.html, so the client follows whatever host/port/scheme the browser used. The HTTP_PORT env var is removed (breaking change for anyone who set it; it's simply unnecessary now).

Testing

Built and ran with only -p 18080:80 published: healthcheck healthy, curl websocket handshake through 18080 returns 101 Switching Protocols with the binary subprotocol, and a real browser session loads q3dm1 and spawns in-game — connection line reads CONNECTING TO LOCALHOST:18080.

🤖 Generated with Claude Code

- Apache mod_proxy_wstunnel routes websocket upgrades on port 80 to the
  internal game server, so one published port serves page, assets, and game
- Patch ioquake3.js at build time: scheme-relative asset URLs and
  protocol-conditional ws/wss, making the client work behind TLS termination
- Entrypoint bakes origin-adaptive host/port expressions into index.html;
  HTTP_PORT is removed (page now works from any host, port, or scheme)
- Drop the 27960 port mapping from compose; direct publish remains optional
- Build fails fast if the engine patches stop matching upstream

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant