-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle static routes in SSR-configured Astro applications #13116
Comments
Hi, I encountered this issue as well. No matter if the output config is server or hybrid, when it encounters a statically rendered page, it logs…
It is especially annoying in case when the page is mostly static, with a very few exceptions of server side rendered output (hybrid mode). |
yeah, we currently treat |
#13306) In Astro middleware, we're not allowed to access the `request.headers` object if the incoming request is for a statically generated/prerendered route. Since we accessed these headers previously, users would get a warning as reported multiple times and tracked in #13116. This patch fixes that by checking for static vs dynamic route
builds on top of #13306, found while working on #13116 This PR ensures that we correctly extract the request data in our Astro middleware. Previously we didn't convert the `request.headers` object into a `Record<string, string>` but simply passed a `Headers` instance. This caused problems with the `requestDataIntegration` which doesn't handle the instance correctly.
Description
This came up internally in Slack. There are cases where users configure their Astro app as
server
(i.e. SSR) but explicitly set some pages as static pages (i.e. opt out of SSR). Our Astro middleware is injected if we find aserver
-configuration.Now in case of requests being made to static pages, our middleware accesses properties in the middleware context that should only be accessed in SSR routes. As a result, the server logs warnings:
We need to somehow find a flag to check in the middleware if the route we’re accessing is static vs. SSR. And if static, we bail and don’t touch the headers
The text was updated successfully, but these errors were encountered: