mirror of
https://github.com/reconurge/flowsint.git
synced 2026-05-07 04:09:49 -05:00
[PR #126] [MERGED] fix(api): Better support to reverse proxy deploy #1118
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/reconurge/flowsint/pull/126
Author: @gustavorps
Created: 2/20/2026
Status: ✅ Merged
Merged: 3/4/2026
Merged by: @dextmorgn
Base:
main← Head:fix/proxy-api📝 Commits (4)
d526697feat(api): added fastapi standardda02805fix(api): added ignore_trailing_slash=True to face 307 redirect reverse proxy issue5ee7bf2fix(api): added redirect_slashes=False to face 307 redirect reverse proxy issueb2cfc67fix(app): removing slashes📊 Changes
7 files changed (+892 additions, -11 deletions)
View changed files
📝
flowsint-api/app/api/routes/chat.py(+1 -1)📝
flowsint-api/app/api/routes/enrichers.py(+1 -1)📝
flowsint-api/app/api/routes/flows.py(+1 -1)📝
flowsint-api/app/api/routes/types.py(+1 -1)📝
flowsint-api/app/main.py(+1 -1)📝
flowsint-api/poetry.lock(+886 -5)📝
flowsint-api/pyproject.toml(+1 -1)📄 Description
This PR aligns FastAPI routing behavior with proxy-safe deployment practices (NGINX/Traefik/Caddy), focusing on eliminating slash-based redirects and making endpoint matching explicit.
Why this change
Behind reverse proxies, automatic trailing-slash redirects can cause:
To reduce these risks, route handling is now explicit and redirect-free.
What changed
1) Route normalization across API routers
Updated root route decorators from
@router.get("/")to@router.get("")in:chat.pyenrichers.pyflows.pytypes.pyThis standardizes route definitions and avoids accidental dual-path behavior.
[1]](diffhunk://#diff-e3588298dd3b26a8d46216216a41d77d2584ee58896b8ffffeb99ed74df78d66L26-R26) [2] [3] [4]
2) FastAPI app slash behavior
Updated app configuration in
main.pyto:redirect_slashes=Falseignore_trailing_slash=TrueThis prevents automatic 307/308 slash redirects and allows consistent handling of URLs with/without trailing slash.
3) Dependency update
Updated pyproject.toml to use
fastapi[standard], ensuring recommended runtime dependencies are installed.Expected impact
Important deployment note
For full proxy correctness, runtime/proxy configuration is still required (outside this code change), including:
fastapi run ... --proxy-headers)X-Forwarded-Proto,X-Forwarded-For, andHostat the proxy layerThese are critical to ensure correct scheme detection, docs URL generation, and client IP handling.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.