Skip to content

Handle static routes in SSR-configured Astro applications #13116

@Lms24

Description

@Lms24

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 a server-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:

`Astro.request.headers` is unavailable in "static" output mode, and in perendered pages within "hybrid" and "server" output modes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: astroIssues related to the Sentry Astro SDK

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions