From ac5b10a9cf0f10a072a2a5bb926b9f936120ad5d Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Tue, 14 Oct 2025 13:53:12 -0700 Subject: [PATCH 1/5] Document skew protection in Netlify adapter --- .../docs/en/guides/integrations-guide/netlify.mdx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/content/docs/en/guides/integrations-guide/netlify.mdx b/src/content/docs/en/guides/integrations-guide/netlify.mdx index 5680018c24680..79f714a429865 100644 --- a/src/content/docs/en/guides/integrations-guide/netlify.mdx +++ b/src/content/docs/en/guides/integrations-guide/netlify.mdx @@ -248,6 +248,20 @@ With [fine-grained cache control](https://www.netlify.com/blog/swr-and-fine-grai standard caching headers like `CDN-Cache-Control` or `Vary`. Refer to the docs to learn about implementing e.g. time to live (TTL) or stale while revalidate (SWR) caching: https://docs.netlify.com/platform/caching +### Skew Protection + +Netlify's [skew protection](https://docs.netlify.com/deployments/skew-protection/) ensures that users accessing your site during a deployment continue to receive content from the same deploy version. The Netlify adapter automatically configures skew protection for Astro features like actions, server islands, view transitions, and prefetch requests by injecting the current deploy ID into internal requests. This prevents version mismatches between the client and server during active deployments. + +While Astro automatically adds the skew protection header for its built-in features, if you are making your own fetch requests to your site, you can include the header manually using the `DEPLOY_ID` environment variable: + +```js +const response = await fetch('/api/endpoint', { + headers: { + 'X-Netlify-Deploy-ID': import.meta.env.DEPLOY_ID, + }, +}); +``` + ### Including or excluding files from Netlify Functions When deploying an Astro site with on-demand rendering to Netlify, the generated functions automatically trace and include server dependencies. However, you may need to customize which files are included in your Netlify Functions. From ae370e4dec3274f8a292bdf9ef6e3ea1e94f9235 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Tue, 14 Oct 2025 13:56:05 -0700 Subject: [PATCH 2/5] add version number --- src/content/docs/en/guides/integrations-guide/netlify.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/docs/en/guides/integrations-guide/netlify.mdx b/src/content/docs/en/guides/integrations-guide/netlify.mdx index 79f714a429865..b67fdd2dc1bd6 100644 --- a/src/content/docs/en/guides/integrations-guide/netlify.mdx +++ b/src/content/docs/en/guides/integrations-guide/netlify.mdx @@ -250,6 +250,8 @@ Refer to the docs to learn about implementing e.g. time to live (TTL) or stale w ### Skew Protection +

+ Netlify's [skew protection](https://docs.netlify.com/deployments/skew-protection/) ensures that users accessing your site during a deployment continue to receive content from the same deploy version. The Netlify adapter automatically configures skew protection for Astro features like actions, server islands, view transitions, and prefetch requests by injecting the current deploy ID into internal requests. This prevents version mismatches between the client and server during active deployments. While Astro automatically adds the skew protection header for its built-in features, if you are making your own fetch requests to your site, you can include the header manually using the `DEPLOY_ID` environment variable: From 203de5ce35fbee81dd5b98194a923637bbc097b8 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 17 Oct 2025 10:00:27 -0400 Subject: [PATCH 3/5] docs: update AstroAdapter interface to include client configuration Add `client` property with `internalFetchHeaders` option to the AstroAdapter interface documentation. This enables adapters like Netlify to inject headers into Astro's internal fetch calls for features like Actions, View Transitions, Server Islands, and Prefetch requests. --- src/content/docs/en/reference/adapter-reference.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/content/docs/en/reference/adapter-reference.mdx b/src/content/docs/en/reference/adapter-reference.mdx index de3542df0e71f..f550efda819a0 100644 --- a/src/content/docs/en/reference/adapter-reference.mdx +++ b/src/content/docs/en/reference/adapter-reference.mdx @@ -53,6 +53,13 @@ interface AstroAdapter { args?: any; adapterFeatures?: AstroAdapterFeatures; supportedAstroFeatures: AstroAdapterFeatureMap; + client?: { + /** + * Headers to inject into Astro's internal fetch calls (Actions, View Transitions, Server Islands, Prefetch). + * Can be an object of headers or a function that returns headers. + */ + internalFetchHeaders?: Record | (() => Record); + }; } export interface AstroAdapterFeatures { From 62dd44b771c3e539bf0788e5fe945494e6ebc168 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 17 Oct 2025 12:41:58 -0400 Subject: [PATCH 4/5] docs: add assetQueryParams to AstroAdapter client configuration Add documentation for the `assetQueryParams` property in the `client` configuration. This allows adapters to append query parameters to all asset URLs (images, stylesheets, scripts, etc.), which is useful for tracking deployment versions or other metadata. --- src/content/docs/en/reference/adapter-reference.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/content/docs/en/reference/adapter-reference.mdx b/src/content/docs/en/reference/adapter-reference.mdx index f550efda819a0..0a3fe53407f5e 100644 --- a/src/content/docs/en/reference/adapter-reference.mdx +++ b/src/content/docs/en/reference/adapter-reference.mdx @@ -59,6 +59,11 @@ interface AstroAdapter { * Can be an object of headers or a function that returns headers. */ internalFetchHeaders?: Record | (() => Record); + /** + * Query parameters to append to all asset URLs (images, stylesheets, scripts, etc.). + * Useful for adapters that need to track deployment versions or other metadata. + */ + assetQueryParams?: URLSearchParams; }; } From 2d7fbde92add9fc24f5d0d4d1961977d8c4f6071 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Wed, 22 Oct 2025 15:09:26 -0400 Subject: [PATCH 5/5] Update src/content/docs/en/guides/integrations-guide/netlify.mdx --- src/content/docs/en/guides/integrations-guide/netlify.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/integrations-guide/netlify.mdx b/src/content/docs/en/guides/integrations-guide/netlify.mdx index b67fdd2dc1bd6..7c72f01a5ee39 100644 --- a/src/content/docs/en/guides/integrations-guide/netlify.mdx +++ b/src/content/docs/en/guides/integrations-guide/netlify.mdx @@ -252,7 +252,7 @@ Refer to the docs to learn about implementing e.g. time to live (TTL) or stale w

-Netlify's [skew protection](https://docs.netlify.com/deployments/skew-protection/) ensures that users accessing your site during a deployment continue to receive content from the same deploy version. The Netlify adapter automatically configures skew protection for Astro features like actions, server islands, view transitions, and prefetch requests by injecting the current deploy ID into internal requests. This prevents version mismatches between the client and server during active deployments. +Netlify's skew protection ensures that users accessing your site during a deployment continue to receive content from the same deploy version. The Netlify adapter automatically configures skew protection for Astro features like actions, server islands, view transitions, and prefetch requests by injecting the current deploy ID into internal requests. This prevents version mismatches between the client and server during active deployments. While Astro automatically adds the skew protection header for its built-in features, if you are making your own fetch requests to your site, you can include the header manually using the `DEPLOY_ID` environment variable: