Closed azlato closed 1 month ago
Thank you for sharing your discovery here @azlato ! I will share this with the team to see if this is a pattern they want to document officially! (Docs can't always contain everything that is possible to do, because that would be impossible!) It's possible that this is not intended use, or maybe we just didn't think of it when documenting!
When we document a pattern, we are committing to maintaining that pattern, and choosing to maintain Astro to keep that working, so sometimes there are things that work that we don't document. We also sometimes only choose one way of doing something, even when multiple are possible.
We always encourage if you've found something you think is worth sharing, to make a blog post and add your link to our community recipes! Sometimes we will add new content, or ask people to contribute their content, from there as an official recipe. Nothing stops you from sharing this, even if we can't quite fit it into docs yet!
I've made a note to bring this to the team and see whether there's a good place for docs for this. But if you write a blog post, please do let us know!
Just following up here that after discussing with the team, this is considered more internal implementation and not expected usage. So, this isn't something for our public documentation, even though it works, but you are welcome to continue using it!
π Subject area/topic
routing and custom error pages
π Suggested page
https://docs.astro.build/en/guides/routing/
π General description or bullet points (if proposing new content)
Astro.response.headers.set('X-Astro-Reroute', 'no')
, If you do this, then you can change status code viaAstro.response.status = 404;
I have found solution in Astro source code, but it is not documented. https://github.com/withastro/astro/blob/8a1abcfd9d0507c68ede46d6f123002956c4340d/packages/astro/src/core/constants.ts#L4-L23π₯οΈ Reproduction of code samples in StackBlitz
No response