This project demonstrates the Netlify skew protection feature that adds X-Netlify-Deploy-ID headers to internal fetch requests in Astro.
Live Demo: https://skew-protection-test.netlify.app/
- Actions: Client-side calls to Astro Actions include the deploy ID header
- View Transitions: Navigation between pages includes the deploy ID header
- Server Islands: (Not included in this demo, but supported)
The project uses preview packages from PR #14543. Install them with:
npm i https://pkg.pr.new/astro@14543
npm i https://pkg.pr.new/@astrojs/netlify@14543Or if the packages are already in package.json:
npm installnpm run devNote: In local development, the deploy ID will show as "local-development" since there's no actual DEPLOY_ID environment variable.
- Create a new site on Netlify
- Connect your repository or drag-and-drop the project folder
- Netlify will automatically detect the Astro framework
- Deploy!
- Open your deployed site
- Open browser Developer Tools (F12)
- Go to the Network tab
- Click the "Call Action" button
- Look for the
POST /_actions/greetrequest - Check the Request Headers for
X-Netlify-Deploy-ID
- Look for the
- Click the "other page" link
- Look for the HTML fetch request
- Check the Request Headers for
X-Netlify-Deploy-ID
- The
X-Netlify-Deploy-IDheader should appear in all internal fetch requests - The value should match the current deployment ID
- This ensures that during deployments, clients always fetch resources from the same deployment version
After building, you can verify the skew protection configuration:
.netlify/v1/skew-protection.json- Contains the skew protection configuration- Built JavaScript files - Will include the header injection code
This project uses the preview release from PR #14543:
{
"astro": "^5.14.5-pr14543.20251014135916",
"@astrojs/netlify": "^6.5.12-pr14543.20251014135916"
}Update these to the latest snapshot versions as needed from the PR.