From b459884ebbefc90753428010a1e4bc62221fbd0d Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Fri, 18 Sep 2026 12:08:34 +0530 Subject: [PATCH] refactor(mqtt): serve MQTT-over-WebSocket on a dedicated TLS port, not a /push path Give the WebSocket carrier its own TLS entrypoint (:8084, mqtt-wss) alongside the mqtts TCP entrypoint (:8883), each a catch-all on its port. The transport is now identified by host+port rather than a URL path, so one push endpoint (e.g. push.cloud.appwrite.io) serves both mqtts:// and wss:// and it no longer shares :443/paths with the API or realtime. Still TLS-only. --- docker-compose.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 79466a7af9..e84c433c59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,10 +22,12 @@ services: - --entrypoints.appwrite_web.address=:80 - --entrypoints.appwrite_websecure.address=:443 - --entrypoints.appwrite_mqtt.address=:8883 + - --entrypoints.appwrite_mqtt_ws.address=:8084 ports: - ${_APP_HTTP_PORT:-80}:80 - ${_APP_HTTPS_PORT:-443}:443 - ${_APP_MQTT_PORT:-8883}:8883 + - ${_APP_MQTT_WSS_PORT:-8084}:8084 volumes: - /var/run/docker.sock:/var/run/docker.sock - appwrite-config:/storage/config:ro @@ -384,14 +386,15 @@ services: - traefik.tcp.routers.appwrite_mqtt.tls=true - traefik.tcp.routers.appwrite_mqtt.service=appwrite_mqtt - traefik.tcp.services.appwrite_mqtt.loadbalancer.server.port=1883 - # MQTT-over-WebSocket for browser clients: wss:///push is terminated at the - # websecure entrypoint and forwarded to the broker's WebSocket listener (:8083). - # TLS-only (no plaintext ws on :80), mirroring the mqtts TCP router, so the reusable - # JWT/session credential in the CONNECT frame never traverses the network in the clear. - - traefik.http.routers.appwrite_mqtt_ws_secure.entrypoints=appwrite_websecure - - traefik.http.routers.appwrite_mqtt_ws_secure.rule=PathPrefix(`/push`) - - traefik.http.routers.appwrite_mqtt_ws_secure.service=appwrite_mqtt_ws - - traefik.http.routers.appwrite_mqtt_ws_secure.tls=true + # MQTT-over-WebSocket for browser clients: wss://:8084 on its own TLS entrypoint + # (a dedicated port, not a URL path), the WebSocket sibling of the mqtts TCP router. The + # port identifies the broker, so a single push host serves both mqtts:// (:8883) and + # wss:// (:8084). TLS-only, so the reusable CONNECT credential never crosses the wire in + # the clear; TLS is terminated here and forwarded to the broker's WebSocket listener (:8083). + - traefik.http.routers.appwrite_mqtt_ws.entrypoints=appwrite_mqtt_ws + - traefik.http.routers.appwrite_mqtt_ws.rule=PathPrefix(`/`) + - traefik.http.routers.appwrite_mqtt_ws.service=appwrite_mqtt_ws + - traefik.http.routers.appwrite_mqtt_ws.tls=true - traefik.http.services.appwrite_mqtt_ws.loadbalancer.server.port=8083 networks: - appwrite