You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Server returns 200 (soft 404) for non-existent routes instead of a real 404 #6463
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
Deploy any Reflex app.
Request a URL that doesn't map to a defined page, e.g. /this-page-does-not-exist.
Observe: response is 200 OK with the SPA fallback HTML.
on what level would you like this to be resolved? as it's typical for people in a production build to put something like Caddy/nginx, and since we produce static frontend we have no script to run there. it depends on the deployment
At the time, this seemed like a better compromise than serving the 404 status for legitimate dynamic routes.
Now that the ASGI server itself serves the exported frontend and knows what the dynamic routes are, we could add some smarts in the static file mount to align the HTTP status code based on the dynamic routes defined.
But performance of production deployments will suffer if all the static file serving has to go through the python origin server.
opened draft pr #6469 to start addressing this... turns out reflex run --env prod had the opposite problem in that it was returning 404 for actual legitimate dynamic routes. So 6469 solves that issue by adjusting the status code for requests that match a known route.
The PR also writes out an app manifest JSON file that could be used to create config files for CDN/proxy servers to know which routes are legit or not; but in the short term at least, instead of always serving the spa fallback when the expected static file is missing, we could instead proxy those requests (with caching) to the origin server, and have the StaticFiles module do the lookup for whether the route is legit or not.
on what level would you like this to be resolved? as it's typical for people in a production build to put something like Caddy/nginx, and since we produce static frontend we have no script to run there. it depends on the deployment
so only for reflex run --env prod? we could do that (as in the PR above), but that wouldn't fix
Deploy any Reflex app
that you put in the issue above, that fix would require reflex cloud coordination as well, which wouldn't fix it for people using caddy (like we do for most of our websites deployed right now), then we can separately fix for caddy (only for us, but maybe we can provide an example for others), but that wouldn't fix for nginx, which we could try another separate example for it
that's why i ask on what level, because the framework level doesn't actually fix it for most deployments, including ours
Activity
linear commentedon May 6, 2026
ENG-9472
adhami3310 commentedon May 7, 2026
on what level would you like this to be resolved? as it's typical for people in a production build to put something like Caddy/nginx, and since we produce static frontend we have no script to run there. it depends on the deployment
masenf commentedon May 7, 2026
At the time, this seemed like a better compromise than serving the 404 status for legitimate dynamic routes.
Now that the ASGI server itself serves the exported frontend and knows what the dynamic routes are, we could add some smarts in the static file mount to align the HTTP status code based on the dynamic routes defined.
But performance of production deployments will suffer if all the static file serving has to go through the python origin server.
fix(app): write routes manifest so standalone frontend can resolve dy…
masenf commentedon May 7, 2026
opened draft pr #6469 to start addressing this... turns out
reflex run --env prodhad the opposite problem in that it was returning 404 for actual legitimate dynamic routes. So 6469 solves that issue by adjusting the status code for requests that match a known route.The PR also writes out an app manifest JSON file that could be used to create config files for CDN/proxy servers to know which routes are legit or not; but in the short term at least, instead of always serving the spa fallback when the expected static file is missing, we could instead proxy those requests (with caching) to the origin server, and have the StaticFiles module do the lookup for whether the route is legit or not.
Alek99 commentedon May 7, 2026
On a framework level
adhami3310 commentedon May 7, 2026
so only for
reflex run --env prod? we could do that (as in the PR above), but that wouldn't fixthat you put in the issue above, that fix would require reflex cloud coordination as well, which wouldn't fix it for people using caddy (like we do for most of our websites deployed right now), then we can separately fix for caddy (only for us, but maybe we can provide an example for others), but that wouldn't fix for nginx, which we could try another separate example for it
that's why i ask on what level, because the framework level doesn't actually fix it for most deployments, including ours