Skip to content

make sure running prod backend only uses backend port#6346

Merged
adhami3310 merged 1 commit intomainfrom
make-sure-running-prod-backend-only-uses-backend-port
Apr 20, 2026
Merged

make sure running prod backend only uses backend port#6346
adhami3310 merged 1 commit intomainfrom
make-sure-running-prod-backend-only-uses-backend-port

Conversation

@adhami3310
Copy link
Copy Markdown
Member

previously it would try frontend port, introduced in the single port PR

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 20, 2026

Greptile Summary

This PR fixes a regression introduced by a "single port" change where running a production backend-only server would incorrectly select from frontend port values (including falling back to DefaultPorts.FRONTEND_PORT) instead of backend port values. The fix splits the port-selection logic in _run for the prod path into three branches based on running_mode, ensuring each mode uses the correct port config and fallback default.

Confidence Score: 5/5

Safe to merge — targeted one-function fix with no new dependencies or logic regressions.

The change is narrow, directly addresses the stated bug (BACKEND_ONLY prod mode using frontend port/fallback), and preserves existing FULLSTACK behavior. No new test surface area is introduced, all branches are simple assignments.

No files require special attention.

Important Files Changed

Filename Overview
reflex/reflex.py Port-selection logic in the prod branch of _run is split by running_mode so each mode reads the correct port config and falls back to the correct default port.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["_run() — prod path"] --> B{running_mode?}
    B -->|BACKEND_ONLY| C["requested_port = backend_port or config.backend_port\nfallback_port = DefaultPorts.BACKEND_PORT"]
    B -->|FRONTEND_ONLY| D["requested_port = frontend_port or config.frontend_port\nfallback_port = DefaultPorts.FRONTEND_PORT"]
    B -->|FULLSTACK| E["requested_port = frontend_port or backend_port\n  or config.frontend_port or config.backend_port\nfallback_port = DefaultPorts.FRONTEND_PORT"]
    C --> F["handle_port(port = requested_port or fallback_port,\nauto_increment = requested_port is None)"]
    D --> F
    E --> F
    F --> G["_run_prod(running_mode, port, backend_host)"]
Loading

Reviews (1): Last reviewed commit: "make sure running prod backend only uses..." | Re-trigger Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 20, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing make-sure-running-prod-backend-only-uses-backend-port (f9d2199) with main (b977e62)

Open in CodSpeed

@adhami3310 adhami3310 merged commit cc7436c into main Apr 20, 2026
48 checks passed
@adhami3310 adhami3310 deleted the make-sure-running-prod-backend-only-uses-backend-port branch April 20, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants