Skip to content
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

404 page missing CSS when 404 server Response redirects to static custom 404 page #7910

Closed
1 task
paulrudy opened this issue Aug 1, 2023 · 2 comments · Fixed by #7946
Closed
1 task

404 page missing CSS when 404 server Response redirects to static custom 404 page #7910

paulrudy opened this issue Aug 1, 2023 · 2 comments · Fixed by #7946
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: ssr Related to SSR (scope)

Comments

@paulrudy
Copy link
Contributor

paulrudy commented Aug 1, 2023

What version of astro are you using?

2.9.7

Are you using an SSR adapter? If so, which one?

Vercel

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome, Safari

Describe the Bug

Perhaps a bit of an edge case, but with the following setup:

  • server mode
  • dynamic route (alphabetically first priority) [...ssrPath].astro redirects non-existing pages to 404 using new Response but does no page rendering
  • dynamic route (alphabetically second priority) [...staticPath].astro renders pages statically (includes export const prerender = true)
  • custom /pages/404.md

The issue is: When deployed on Vercel, navigating to a non-existent page renders the custom 404 page, but without CSS.

Additional notes:

  • Going directly to the 404 page does successfully include CSS
  • If the Response is changed to an Astro redirect (return Astro.redirect('/404')), CSS is included in the 404 page after the redirect
  • This issue does not occur locally. With vercel dev or astro dev, CSS is included after the 404 Response.

What's the expected result?

CSS should be included in the custom 404 page rendered after a 404 Response

Link to Minimal Reproducible Example

repo
demo

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 1, 2023
@natemoo-re natemoo-re added - P3: minor bug An edge case that only affects very specific usage (priority) feat: ssr Related to SSR (scope) labels Aug 1, 2023
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Aug 1, 2023
@natemoo-re
Copy link
Member

Thanks for opening an issue! Looks like this was partially introduced by #7754 which fixed the 404 behavior. In this case, the 404.md page is server-rendered but when we rewrite the request, we're not including the correct CSS before rendering.

@paulrudy
Copy link
Contributor Author

paulrudy commented Aug 1, 2023

Thanks for opening an issue! Looks like this was partially introduced by #7754 which fixed the 404 behavior. In this case, the 404.md page is server-rendered but when we rewrite the request, we're not including the correct CSS before rendering.

I'm not sure how #7754 affected it, but in case it's helpful to know, I was encountering the issue before that was merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: ssr Related to SSR (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants