Skip to content
16 changes: 16 additions & 0 deletions src/content/docs/en/guides/integrations-guide/netlify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,22 @@ 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

<p><Since v="6.6.0" pkg="@astrojs/netlify" /></p>

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:

```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.
Expand Down
12 changes: 12 additions & 0 deletions src/content/docs/en/reference/adapter-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ 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<string, string> | (() => Record<string, string>);
/**
* 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;
};
}

export interface AstroAdapterFeatures {
Expand Down