Reverse-Proxy self-hosted Supabase with Caddy

localhost in a container means “this same container”.

You need to use the other container’s name as the hostname. So if your container is named supabase, you’d do reverse_proxy supabase:3000.

Make sure both containers share a Docker network.

FYI this will only require authentication for exactly / and nothing else. If you want auth for all pages, you should use remove the / path matcher (leaving it blank means “match all requests”. See Request matchers (Caddyfile) — Caddy Documentation

You can simplify this by using a single path matcher for all of these:

@api path /rest/v1/* /auth/v1/* /realtime/v1/* /storage/v1/*
reverse_proxy @api supabase:8000
2 Likes