Skip to content

Middleware not called for non-custom 404 page #7881

@xriter

Description

@xriter

What version of astro are you using?

2.9.6

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

Node

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Safari

Describe the Bug

When you have middleware.ts setup, and a custom 404 page, the middleware will get called when you hit a 404 page. However, if you don't have a custom 404 page but rely on the default, the middleware won't get called.

Wondering if this is a deliberate decision?

What's the expected result?

Consistency between the custom and non-custom 404 page. Both should call the middleware.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-pt4enm?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)feat: error pagesRelated to 404 and 500 handling (scope)feat: middlewareRelated to middleware (scope)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions