I have an Astro website, and I’m struggling to properly deploy in SSR mode.
Using Netlify CLI netlify dev, SSR routes work, redirects and headers apply, except Content-Security-Policy if present in netlify.toml, the server crashes and throws an error:
Netlify configuration redirects, headers only work on static (pre-rendered) routes, such as /static/ route for example.
Also, the custom /404 page does not handle not found routes in SSR, instead showing a blank page with the text “Not Found” (if you remove this page, Netlify uses its own default version). In main project most of the routes don’t work, I guess it’s because of using urql as the fetch library.
.env:
AWS_LAMBDA_JS_RUNTIME=nodejs16.x
NODE_VERSION=16.19.0
stackblitz: Predaytor - Astro Ssr Netlify - StackBlitz
deploy (using trailing slash):
https://luxury-capybara-511d8e.netlify.app/


