From f63fba2650a05811b8f6e62252004c8db5f02c4c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 00:54:09 +0000 Subject: [PATCH 1/2] Correct 0.10.1 news fragments and document REFLEX_BACKEND_START_METHOD The 7258 fragment described the opposite of what #7304 does (it raises an error for a missing __init__.py instead of loading the app), the repeated headers fragment still claimed client_ip came from the first x-forwarded-for hop after #7614 made that depend on trusted_proxy_hops, and the 7261 fragment belonged to a docs-only change. Add the backend start method variables to the self-hosting docs; they were only described in environment.py. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016T8wWv8bUUSzRHNGpKbSqW --- docs/hosting/self-hosting.md | 8 ++++++++ news/+7261.docs.md | 1 - news/+repeated-request-headers.bugfix.md | 2 +- news/7258.bugfix.md | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) delete mode 100644 news/+7261.docs.md diff --git a/docs/hosting/self-hosting.md b/docs/hosting/self-hosting.md index bbe71041931..4ca68f946c6 100644 --- a/docs/hosting/self-hosting.md +++ b/docs/hosting/self-hosting.md @@ -50,6 +50,14 @@ from a single server on port `3000`. Pass `--frontend-port` or the server runs up to 8 backend workers by default (`2 * cpu_count + 1`, capped at 8). When using Granian, set `GRANIAN_WORKERS` to override the default, including to use more workers. +On Linux, backend workers are forked from a supervisor process that has already +imported the app, so they share its memory instead of each importing the app +again. Set `REFLEX_BACKEND_START_METHOD=spawn` (or `forkserver`) for apps that +are not fork-safe, for example ones that open database connections or start +threads at import time. The same variable applies to the `reflex run` +development backend, where `REFLEX_STRICT_HOT_RELOAD=1` also switches to +spawned workers so environment variable changes are picked up on hot reload. + The frontend and backend can also run as separate processes, for example to serve the frontend from a CDN and scale the backend independently. The frontend-only server only serves static files, so tell it where the backend diff --git a/news/+7261.docs.md b/news/+7261.docs.md deleted file mode 100644 index 3e010f15589..00000000000 --- a/news/+7261.docs.md +++ /dev/null @@ -1 +0,0 @@ -Document how `frontend_path` affects asset URLs and recommend `rx.asset()` for local assets. diff --git a/news/+repeated-request-headers.bugfix.md b/news/+repeated-request-headers.bugfix.md index 75388bfd97a..af8216fc2f5 100644 --- a/news/+repeated-request-headers.bugfix.md +++ b/news/+repeated-request-headers.bugfix.md @@ -1 +1 @@ -Repeated request headers are no longer collapsed to their last value: repeated `cookie` fields are joined with `"; "` and any other repeated field with `", "`, so `router.headers.cookie` keeps every cookie and `router.session.client_ip` is taken from the first `x-forwarded-for` hop. +Repeated request headers are no longer collapsed to their last value: repeated `cookie` fields are joined with `"; "` and any other repeated field with `", "`, so `router.headers.cookie` keeps every cookie. diff --git a/news/7258.bugfix.md b/news/7258.bugfix.md index e6ada15bc5e..fb1cb88940f 100644 --- a/news/7258.bugfix.md +++ b/news/7258.bugfix.md @@ -1 +1 @@ -Load backend apps by their configured module name so state updates work even when the app package has no `__init__.py`. +`reflex run` now fails with a clear error naming the missing `__init__.py` when the app package is not importable as a package, instead of starting a backend whose state updates never reach the page. From 6ea978cd52be387a61f76e3026a5a7fb1ca73a22 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 00:58:07 +0000 Subject: [PATCH 2/2] Keep the 7258 fragment and scope the start method docs to Granian #7304 ended up passing Granian the configured module target, so the original fragment was accurate. The start method variables are only read on the Granian code paths. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016T8wWv8bUUSzRHNGpKbSqW --- docs/hosting/self-hosting.md | 16 +++++++++------- news/7258.bugfix.md | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/hosting/self-hosting.md b/docs/hosting/self-hosting.md index 4ca68f946c6..439c2fe4723 100644 --- a/docs/hosting/self-hosting.md +++ b/docs/hosting/self-hosting.md @@ -50,13 +50,15 @@ from a single server on port `3000`. Pass `--frontend-port` or the server runs up to 8 backend workers by default (`2 * cpu_count + 1`, capped at 8). When using Granian, set `GRANIAN_WORKERS` to override the default, including to use more workers. -On Linux, backend workers are forked from a supervisor process that has already -imported the app, so they share its memory instead of each importing the app -again. Set `REFLEX_BACKEND_START_METHOD=spawn` (or `forkserver`) for apps that -are not fork-safe, for example ones that open database connections or start -threads at import time. The same variable applies to the `reflex run` -development backend, where `REFLEX_STRICT_HOT_RELOAD=1` also switches to -spawned workers so environment variable changes are picked up on hot reload. +When using Granian on Linux, backend workers are forked from a supervisor +process that has already imported the app, so they share its memory instead of +each importing the app again. Set `REFLEX_BACKEND_START_METHOD=spawn` (or +`forkserver`) for apps that are not fork-safe, for example ones that open +database connections or start threads at import time. The same variable applies +to the Granian `reflex run` development backend, where `REFLEX_STRICT_HOT_RELOAD=1` +also switches to spawned workers (unless `REFLEX_BACKEND_START_METHOD` is set) so +environment variable changes are picked up on hot reload. Neither variable +affects the Uvicorn backend. The frontend and backend can also run as separate processes, for example to serve the frontend from a CDN and scale the backend independently. The diff --git a/news/7258.bugfix.md b/news/7258.bugfix.md index fb1cb88940f..e6ada15bc5e 100644 --- a/news/7258.bugfix.md +++ b/news/7258.bugfix.md @@ -1 +1 @@ -`reflex run` now fails with a clear error naming the missing `__init__.py` when the app package is not importable as a package, instead of starting a backend whose state updates never reach the page. +Load backend apps by their configured module name so state updates work even when the app package has no `__init__.py`.