Enforcing SSL on direct database connections
We’ve learned about connecting directly to the database in Chapter 2. This direct connection doesn’t require SSL, which maximizes overall database client compatibility. However, most current clients do support SSL. You can enforce Supabase to only accept SSL-secured connections using the following command:
npx supabase ssl-enforcement --project-ref YOUR_PROJECT_ID update --enable-db-ssl-enforcement --experimental
Here, I’ve used the --project-ref
parameter (which is the ID of your supabase.com project in the API URL: https://YOUR_PROJECT_ID.supabase.com
), but you can also use --linked
if you’ve linked a project previously with npx
supabase link
.
Enforcing SSL for local development isn’t useful, which is probably why it isn’t possible with the CLI.
Note
You can find more information on enforcing SSL here: https://supabase.com/docs/guides/platform/ssl-enforcement.