Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Move Storage CDN doc to the Storage directory

dannykng3f0be7e1520a
diff --git a/apps/docs/components/Navigation/Navigation.constants.ts b/apps/docs/components/Navigation/Navigation.constants.ts
index 8000e07e607..5fe01d07856 100644
--- a/apps/docs/components/Navigation/Navigation.constants.ts
+++ b/apps/docs/components/Navigation/Navigation.constants.ts
@@ -246,7 +246,7 @@ export const menuItems: NavMenu = {
{ name: 'Overview', url: '/guides/storage', items: [] },
{ name: 'Quickstart', url: '/guides/storage/quickstart', items: [] },
{ name: 'Access Control', url: '/guides/storage/access-control', items: [] },
- { name: 'CDN', url: '/guides/storage-cdn', items: [] },
+ { name: 'CDN', url: '/guides/storage/cdn', items: [] },
],
},
{
diff --git a/apps/docs/pages/guides/storage-cdn.mdx b/apps/docs/pages/guides/storage/cdn.mdx
similarity index 73%
rename from apps/docs/pages/guides/storage-cdn.mdx
rename to apps/docs/pages/guides/storage/cdn.mdx
index 4c11ca8fe64..1d5023c7dc0 100644
--- a/apps/docs/pages/guides/storage-cdn.mdx
+++ b/apps/docs/pages/guides/storage/cdn.mdx
@@ -3,27 +3,19 @@ import Layout from '~/layouts/DefaultGuideLayout'
export const meta = {
id: 'storage-cdn',
title: 'Storage CDN',
- description: 'How Supabase Storage caches objects with a CDN',
+ description: 'Learn how Supabase Storage caches objects with a CDN.',
sidebar_label: 'CDN',
}
-## CDN basics
+All assets uploaded to Supabase Storage are cached on a Content Delivery Network (CDN) to improve the latency for users all around the world. CDNs are a geographically distributed set of servers or **nodes** which caches content from an **origin server**. For Supabase Storage, the origin is the storage server running in the [same region as your project](https://app.supabase.com/project/_/settings/general). Aside from performance, CDNs also help with security and availability by mitigating Distributed Denial of Service and other application attacks.
-All assets uploaded to storage are cached on a Content Delivery Network (CDN).
-
-To improve the latency for users all around the world, Supabase uses a CDN. CDNs are a geographically distributed set of servers or **nodes** which caches content from an **origin server**. For Supabase Storage, the origin is the storage server running in the [same region as your project](https://app.supabase.com/project/_/settings/general).
+## Example
Let’s walk through an example of how a CDN helps with performance. A new bucket is created for a Supabase project launched in Singapore. All requests to the Supabase Storage API first hit the CDN. A user from the United States requests an object and is routed to the U.S. CDN. At this point, that CDN node does not have the object in its cache and pings the origin server in Singapore. Another user, also in the United States, requests the same object and is served directly from the CDN cache in the United States instead of routing the request back to Singapore.
-Aside from performance, CDNs also help with security and availability by mitigating Distributed Denial of Service and other application attacks.
-
## Cache duration
-By default, assets are cached both in the CDN and in the user's browser for 1 hour. After this, the CDN nodes ping the storage server to see if an object has been updated.
-
-You can modify this cache time when you are [uploading](/docs/reference/javascript/storage-from-upload) or [updating](/docs/reference/javascript/storage-from-update) an object by modifying the `cacheControl` parameter.
-
-If you expect the object to not change at a given URL, setting a longer cache duration is preferable.
+By default, assets are cached both in the CDN and in the user's browser for 1 hour. After this, the CDN nodes ping the storage server to see if an object has been updated. You can modify this cache time when you are [uploading](/docs/reference/javascript/storage-from-upload) or [updating](/docs/reference/javascript/storage-from-update) an object by modifying the `cacheControl` parameter. If you expect the object to not change at a given URL, setting a longer cache duration is preferable.
If you need to update the version of the object stored in the CDN, there are various cache-busting techniques you can use. The most common way to do this is to add a version query parameter in the URL. For example, you can use a URL like `/storage/v1/object/sign/profile-pictures/cat.jpg?token=eyJh...&version=1` in your applications and set a long cache time of 1 year. When you want to update the cat picture, you can increment the version query parameter in the URL. The CDN will treat `/storage/v1/object/sign/profile-pictures/cat.jpg?token=eyJh...&version=2` as a new object and pings the origin for the updated version.
diff --git a/apps/www/lib/redirects.js b/apps/www/lib/redirects.js
index c370fc9ce29..9edc1371bfa 100644
--- a/apps/www/lib/redirects.js
+++ b/apps/www/lib/redirects.js
@@ -1560,4 +1560,9 @@ module.exports = [
source: '/forgot-password',
destination: 'https://app.supabase.com/forgot-password',
},
+ {
+ permanent: true,
+ source: '/docs/guides/storage-cdn',
+ destination: '/docs/guides/storage/cdn',
+ },
]