The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: add docs for network restrictions
Div Arora2db1181b7aa9
diff --git a/apps/docs/components/Navigation/Navigation.constants.ts b/apps/docs/components/Navigation/Navigation.constants.tsindex 5db85450719..fb3ab2dc305 100644--- a/apps/docs/components/Navigation/Navigation.constants.ts+++ b/apps/docs/components/Navigation/Navigation.constants.ts@@ -264,6 +264,7 @@ export const menuItems: NavMenu = {url: '/guides/platform/migrating-and-upgrading-projects',items: [],},+ { name: 'Network Restrictions', url: '/guides/platform/network-restrictions', items: [] },{ name: 'Performance Tuning', url: '/guides/platform/performance', items: [] },{ name: 'Permissions', url: '/guides/platform/permissions', items: [] },{ name: 'Production Readiness', url: '/guides/platform/going-into-prod', items: [] },diff --git a/apps/docs/pages/guides/platform/network-restrictions.mdx b/apps/docs/pages/guides/platform/network-restrictions.mdxnew file mode 100644index 00000000000..0c98e594447--- /dev/null+++ b/apps/docs/pages/guides/platform/network-restrictions.mdx@@ -0,0 +1,71 @@+import Layout from '~/layouts/DefaultGuideLayout'++export const meta = {+ id: 'network-restrictions',+ title: 'Network Restrictions',+ description: "Apply network restrictions for your project's database.",+}++<Admonition type="note">++Network Restrictions are currently in beta, and are being slowly made available to all projects.++The current iteration of Network Restrictions applies to connections to Postgres and Pgbouncer. Support for restricting connections to Postgrest, Storage, and Auth will be added at a later date.++</Admonition>++Each Supabase project comes with configurable restrictions on the IP ranges that are allowed to connect to Postgres and Pgbouncer ("your database"). These restrictions are enforced before traffic reaches your database; if a connection is allowed by a network restriction, it will still need to authenticate successfully with valid credentials.++To get started:++1. [Install](/docs/guides/cli) the Supabase CLI 1.22.0+.+1. [Log in](/docs/guides/cli/local-development#log-in-to-the-supabase-cli) to your Supabase account using the CLI.+1. Ensure that you have [Owner or Admin permissions](/docs/guides/hosting/platform#manage-team-members) for the project you'd like to set up network restrictions for.++## Check restrictions++You can use the `get` subcommand of the CLI to retrieve the restrictions currently in effect.++If restrictions have been applied, the output of the `get` command will reflect the IP ranges allowed to connect:++```bash+> supabase network-restrictions --project-ref {ref} get --experimental+DB Allowed CIDRs: [128.12.1.1/16 183.12.1.1/24]+Restrictions applied successfully: true+```++If restrictions have never been applied to your project, the list of allowed CIDRs will be empty, but they will also not have been applied ("Restrictions applied successfully: false"). As a result, all IPs are allowed to connect to your database:++```bash+> supabase network-restrictions --project-ref {ref} get --experimental+DB Allowed CIDRs: []+Restrictions applied successfully: false+```++## Update restrictions++The `update` subcommand is used to apply network restrictions to your project:++```bash+> supabase network-restrictions --project-ref {ref} update --db-allow-cidr 128.12.1.1/16 --db-allow-cidr 183.12.1.1/24 --experimental+DB Allowed CIDRs: [128.12.1.1/16 183.12.1.1/24]+Restrictions applied successfully: true+```++The restrictions specified (in the form of CIDRs) replaces any restrictions that might have been applied in the past.+To add to the existing restrictions, you must include the existing restrictions within the list of CIDRs provided to the `update` command.++## Remove restrictions++To remove all restrictions on your project, you can use the `update` subcommand with the CIDR `0.0.0.0/0`:++```bash+> supabase network-restrictions --project-ref {ref} update --db-allow-cidr 0.0.0.0/0 --experimental+DB Allowed CIDRs: [0.0.0.0/0]+Restrictions applied successfully: true+```++## Limitations++1. Network Restrictions do not currently apply to APIs offered over HTTPS (e.g. Postgrest, Storage, Auth).+1. Network Restrictions should not be used if you require your edge functions to be able to connect to your project's postgres or pgbouncer endpoints.