#9881: chore(compose): harden gateway (localhost ports, limits, logging, healthcheck)
gateway
docker
stale
Cluster:
Docker and Deployment Improvements
Harden gateway bindings to localhost in compose (safer defaults)
Add limits/logging and a healthcheck for gateway
Fix WS connect auth resolution from cookie on upgrade
Minor infra tweak: omit port on https canvas host URL
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR hardens the Docker Compose gateway by binding exposed ports to localhost, adding container memory limits/logging rotation, and introducing a TCP healthcheck. It also adjusts gateway WS connect authentication handling and changes canvas host URL formatting to omit the port on HTTPS.
Main integration points are the compose runtime defaults (`docker-compose.yml`), the WS handshake path in `src/gateway/server/ws-connection/message-handler.ts` (connect/auth), and URL generation in `src/infra/canvas-host-url.ts` (used wherever the canvas host URL is surfaced to clients).
<h3>Confidence Score: 2/5</h3>
- Not safe to merge as-is due to a WS handler compile/runtime breakage.
- The WS message handler introduces an undefined helper and redeclares auth variables, which will either fail typechecking/build or crash on the first connect handshake. The canvas URL change also breaks HTTPS deployments on non-default ports.
- src/gateway/server/ws-connection/message-handler.ts, src/infra/canvas-host-url.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#8050: fix: docker hardening
by christopherbarnett96 · 2026-02-03
85.9%
#4695: Fixed the default CLI image to use published GHCR image
by TASMAYU · 2026-01-30
81.6%
#9992: Docker: Fixed port mapping so ports publish when not stated
by Lightmean03 · 2026-02-06
80.3%
#9190: feat(docker): Add autonomous container self-restart and runtime pac...
by alexdredmon · 2026-02-05
79.4%
#11478: Chore: add Dockerfile HEALTHCHECK and debug-log silent catch blocks
by U-C4N · 2026-02-07
78.7%
#13950: fix(docker): add browser sidecar service and health checks
by n24q02m · 2026-02-11
78.7%
#12504: fix: allow docker cli container to connect to gateway
by bvanderdrift · 2026-02-09
78.3%
#8713: feat: gateway memory monitor, install linger, docs and failover
by quratus · 2026-02-04
78.0%
#6512: Claude/setup open claw agent f v sqk
by franelcisco · 2026-02-01
77.8%
#13539: Claude/update dockerfile cmd 1 te te
by federiconicolasvozza-oss · 2026-02-10
77.1%