Skip to content

Server returns 200 (soft 404) for non-existent routes instead of a real 404 #6463

@Alek99

Description

@Alek99

Describe the bug

Reflex apps return HTTP 200 for URLs that don't correspond to any real page, serving the SPA fallback as the response body. This is a soft 404: the page doesn't exist, but the server signals success. Crawlers, AI agents, and SEO tooling all treat the response as a valid page and try to extract content from what is effectively an error state.

The root cause is that the SPA fallback is doing double duty. It's how Reflex resolves dynamic routes and other runtime-resolved paths and it's what gets served when a URL doesn't match anything. Both cases hit the same fallback, so the server can't distinguish "valid dynamic route" from "nonexistent page"

We need to be able to distinguish between the two

To Reproduce

  1. Deploy any Reflex app.
  2. Request a URL that doesn't map to a defined page, e.g. /this-page-does-not-exist.
  3. Observe: response is 200 OK with the SPA fallback HTML.
  4. Expected: 404 Not Found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions