fix(nginx): proxy to kua-mail container directly over internal Docker network

Avoids SSL loop through public domain. Join kua-services network to reach kua-mail:3800.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kavi 2026-04-22 03:37:44 -04:00
parent 57f1c1440b
commit 5dcdb65e55
2 changed files with 9 additions and 6 deletions

View File

@ -5,6 +5,7 @@ services:
restart: unless-stopped restart: unless-stopped
networks: networks:
- production_proxy - production_proxy
- kua-services
labels: labels:
- "caddy=mail.kua.cl" - "caddy=mail.kua.cl"
- "caddy.reverse_proxy={{upstreams 80}}" - "caddy.reverse_proxy={{upstreams 80}}"
@ -18,3 +19,5 @@ services:
networks: networks:
production_proxy: production_proxy:
external: true external: true
kua-services:
external: true

View File

@ -3,10 +3,10 @@ server {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
# Proxy /api/* backend (strip /api prefix) # Proxy /api/* kua-mail container on internal Docker network (strip /api prefix)
location /api/ { location /api/ {
proxy_pass https://api.mail.kua.cl/; proxy_pass http://kua-mail:3800/;
proxy_set_header Host api.mail.kua.cl; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off; proxy_buffering off;
@ -15,10 +15,10 @@ server {
proxy_set_header Connection ''; proxy_set_header Connection '';
} }
# Proxy /events backend (no prefix strip) # Proxy /events kua-mail SSE endpoint
location /events { location /events {
proxy_pass https://api.mail.kua.cl/events; proxy_pass http://kua-mail:3800/events;
proxy_set_header Host api.mail.kua.cl; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off; proxy_buffering off;