Non-existing page 200 status code in network tab #33498
Unanswered
wouter-blockken
asked this question in
Help
Replies: 1 comment 2 replies
-
|
I believe this is an example of this issue. When following this guide, you will see a 200 code on non-default 404 pages. There isn't a current workaround, but I believe a solution could be allowing a exports.onCreatePage = async ({ page, actions }) => {
const { createPage, deletePage } = actions
// Check if the page is a localized 404
if (page.path.match(/^\/[a-z]{2}\/404\/$/)) {
const oldPage = { ...page }
// Get the language code from the path, and match all paths
// starting with this code (apart from other valid paths)
const langCode = page.path.split(`/`)[1]
page.matchPath = `/${langCode}/*`
// Recreate the modified page
deletePage(oldPage)
createPage(
...page,
// add status code here
statusCode: '404'
)
}
}This would then match the same option that is available in |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
I think i might have found a bug. Not too sure if it's solvable with additional configuration, but this is what happens. Whenever we go to an url withouth the language param included in the url (localhost:8000/random) we get a 404 error as expected in the network tab.

But when i do include the language param (/en/) we get a 200 status (even tho the page doesn't exist).

Someone that knows what's going on? Thanks for helping out!
Beta Was this translation helpful? Give feedback.
All reactions