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

Aperta
#6,463 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
backend, web-dev

Direzione di ricerca

Start by tracing the server's SPA fallback and route-matching handling, then reproduce the request to /this-page-does-not-exist in a deployed Reflex app. Done means undefined routes return HTTP 404 while valid dynamic routes and other runtime-resolved paths continue to work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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.
Lingua principale
Python
Stelle
29k
Fork
1.8k
Merge medio
3g 5h
PR unite (30g)
182

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di reflex-dev/reflex

Tutte le issue di reflex-dev/reflex

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.