Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): proxy API in Traefik image (#131)

Aqil Aziz4309ebdaddb3
diff --git a/dashboard/Dockerfile.traefik b/dashboard/Dockerfile.traefik
index d51ea424f..397fd0d94 100644
--- a/dashboard/Dockerfile.traefik
+++ b/dashboard/Dockerfile.traefik
@@ -15,12 +15,32 @@ FROM nginx:alpine
# Copy built static files
COPY --from=builder /app/dist /usr/share/nginx/html
-# Simple nginx config for SPA (Traefik handles routing)
+# Simple nginx config for SPA (Traefik handles public routing).
+# Keep API/WebSocket requests same-origin so the dashboard also works when
+# users bring their own external reverse proxy.
RUN echo 'server { \
listen 80; \
server_name localhost; \
root /usr/share/nginx/html; \
index index.html; \
+ location /api/ { \
+ proxy_pass http://openwa-api:2785; \
+ proxy_http_version 1.1; \
+ proxy_set_header Host $host; \
+ proxy_set_header X-Real-IP $remote_addr; \
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \
+ proxy_set_header X-Forwarded-Proto $scheme; \
+ } \
+ location /socket.io/ { \
+ proxy_pass http://openwa-api:2785; \
+ proxy_http_version 1.1; \
+ proxy_set_header Upgrade $http_upgrade; \
+ proxy_set_header Connection "upgrade"; \
+ proxy_set_header Host $host; \
+ proxy_set_header X-Real-IP $remote_addr; \
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; \
+ proxy_set_header X-Forwarded-Proto $scheme; \
+ } \
location / { \
try_files $uri $uri/ /index.html; \
} \