Files
faunosteo/docker/dev-gateway/nginx.conf
T
bchanot 3e48b0d848 chore(workspace): DEV least-privilege exposure — nginx DEV gateway (API on the LAN, Mailpit behind basic auth), network check from a distinct origin, loopback default for the rootless daemon documented
The Supabase CLI publishes 54321-54324 on every interface with no bind
option. Design: the rootless daemon binds published ports on loopback by
default (~/.config/docker/daemon.json {"ip":"127.0.0.1"}, owner action,
not applied), and the DEV gateway (Compose service dev-gateway, profile
dev, container faunosteo_dev_gateway) re-publishes only the API (Kong) and
Mailpit behind HTTP basic auth on FAUNOSTEO_DEV_HOST; Studio and PostgreSQL
stay loopback (SSH tunnel for Studio). pnpm dev:gateway generates the Mailpit
credentials (gitignored; htpasswd 644 because the rootless container user
cannot read a 600 file, hash only). pnpm dev:net-check probes from a
throwaway container on its own Docker network: app, API health, REST 401,
Mailpit 401/200, PostgreSQL and Studio closed. Gateway proven on alternate
ports (health 200, password login 200, Mailpit 401 / 200).
2026-10-13 22:38:40 +02:00

47 lines
1.6 KiB
Nginx Configuration File

# DEV gateway (docs/development/ENVIRONMENTS.md §3): the only two Supabase surfaces
# re-published on the private network once the rootless Docker daemon binds published
# ports on loopback by default. Upstreams are resolved through Docker's DNS on every
# request (variables + resolver) so a restarted stack is followed without a restart here.
resolver 127.0.0.11 valid=10s ipv6=off;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Supabase API (Kong: Auth, PostgREST, Storage) for the browsers of the LAN.
server {
listen 54321;
server_name _;
client_max_body_size 16m; # avatar uploads are capped at 5 MiB by the bucket
location / {
set $kong http://supabase_kong_faunosteo:8000;
proxy_pass $kong;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_request_buffering off;
proxy_read_timeout 120s;
}
}
# Mailpit (DEV mails: confirmation and recovery links) behind HTTP basic auth.
server {
listen 54324;
server_name _;
auth_basic "Faunosteo DEV mail";
auth_basic_user_file /etc/nginx/htpasswd;
location / {
set $mailpit http://supabase_inbucket_faunosteo:8025;
proxy_pass $mailpit;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 3600s;
}
}