How to secure the self-hosted supabase studio? #43852
-
|
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
|
Check https://supabase.com/docs/guides/self-hosting/self-hosted-proxy-https :) The included Caddy/Nginx examples include basic auth that substitute the one in Kong. |
Beta Was this translation helpful? Give feedback.
-
|
The default Studio credentials ( 1. Separate Nginx server block for StudioYou said you can't IP-whitelist because Kong handles multiple services. The fix: route Studio traffic directly to the Studio container (port 3000) instead of through Kong, using a dedicated subdomain or port: server {
listen 443 ssl;
server_name studio.yourdomain.com;
ssl_certificate /etc/ssl/certs/yourdomain.crt;
ssl_certificate_key /etc/ssl/private/yourdomain.key;
# Only allow your IP(s)
allow 203.0.113.10; # your IP
deny all;
location / {
proxy_pass http://localhost:3000; # Studio directly, not Kong
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen 443 ssl;
server_name api.yourdomain.com;
location / {
proxy_pass http://localhost:8000; # Kong for API traffic
}
}2. Tailscale / WireGuard VPNProbably the simplest production-grade approach. Put Studio behind a VPN so it's only accessible from your private network. With Tailscale, it's literally:
Zero Nginx changes needed. Free for personal use. 3. Cloudflare Tunnel + AccessIf you're already on Cloudflare:
This gives you SSO-grade auth before anyone even reaches Studio. 4. OAuth2 Proxy as a sidecarRun oauth2-proxy as another Docker container in front of Studio. Gives you Google/GitHub login before anyone can touch Studio. Add it to your My recommendation: Tailscale if you want least moving parts, or Cloudflare Tunnel + Access if you're already using Cloudflare. Both are free and far more secure than any password scheme. |
Beta Was this translation helpful? Give feedback.
-
|
Glad it helped! Let me address both issues: 1. Kong binding to
|
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your answer @manimovassagh —your solution is really good. I actually managed to stop Studio from being exposed on I edited the Now Do you think this is a good approach? |
Beta Was this translation helpful? Give feedback.
-
|
Yes, that works and it's actually a clean approach — you're solving the problem at the source instead of patching it at the Nginx level. By removing the Studio route from Kong, Kong no longer knows how to serve Studio at all. So even if someone hits One small improvement: Instead of Kong returning a raw error (which leaks that you're running Kong), you can add a default catch-all route in - name: catch-all
url: http://localhost:8000
routes:
- name: fallback
paths:
- /
strip_path: false
plugins:
- name: request-termination
config:
status_code: 404
message: "Not found"This way unmatched paths return a clean One thing to keep in mind: When you update Supabase (e.g.
Defense in depth — both Kong route removal + Nginx path filtering together is the most resilient setup. |
Beta Was this translation helpful? Give feedback.
The default Studio credentials (
DASHBOARD_USERNAME/DASHBOARD_PASSWORDin your.env) are just basic auth and not great for production exposure. Here are a few approaches in order of practicality:1. Separate Nginx server block for Studio
You said you can't IP-whitelist because Kong handles multiple services. The fix: route Studio traffic directly to the Studio container (port 3000) instead of through Kong, using a dedicated subdomain or port: