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](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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link is a 404 for me, and I can't seem to find anything quickly in Netlify's docs for skew protection. Do you have another link, Matthew?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They haven't published it yet, I'll send you the preview url later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! Then no concerns as long as it's live by the time docs publish

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct link would be https://docs.netlify.com/deploy/deploy-overview/#skew-protection
This is a new section in an existing page, so it won't completely break. But I would aim to get it live on our end soon as you're ready.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @eladroz ! We will be publishing the release today, and I see Matthew has removed the link entirely for now. We are happy to update the page as soon as the page is live, even if it's not included at time of publishing! We'll try to remember, but you're welcome to make a PR to this page directly at any time once the Netlify section is live on the page!

Comment thread
matthewp marked this conversation as resolved.
Outdated

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