Skip to content

404 page in dev server returns 200 status code instead of 404 #11095

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

Open
6 of 7 tasks
tats-u opened this issue Apr 13, 2025 · 1 comment
Open
6 of 7 tasks

404 page in dev server returns 200 status code instead of 404 #11095

tats-u opened this issue Apr 13, 2025 · 1 comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers

Comments

@tats-u
Copy link
Contributor

tats-u commented Apr 13, 2025

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

If you try to access to assets that don't exist, they must be 404, but 200 are returned. It makes harder to debug because it is confusing with existing assets.
If you try to load static CSS files in your site, the content of 404 page will be tried to be interpreted as CSS.

Reproducible demo

No response

Steps to reproduce

  1. Create a Docusaurus site
  2. node --run start (Node 22)
  3. Launch your browser
  4. Press F12 to open the Dev tab, then switch to "Network" tab
  5. Open http://localhost:3000/foo/bar/baz/qux/quux or a URL in localhost:3000 where no page exists
  6. Check its status code

Instead of 3–6, you can run curl -I http://localhost:3000/foo/bar/baz/qux/quux.

Expected behavior

Status code is 404

Actual behavior

Status code is 200

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used: 3.7.0
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Node 22.13.1
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 11

Self-service

  • I'd be willing to fix this bug myself.
@tats-u tats-u added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Apr 13, 2025
@tats-u tats-u changed the title 404 page in dev server returns 200 status code 404 page in dev server returns 200 status code instead of 404 Apr 13, 2025
@Codimow
Copy link

Codimow commented Apr 19, 2025

what? it works js fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants