fix(routes): add explicit redirects for /merchants and /admin without trailing slash
Some checks failed
Some checks failed
The CMS /{slug} catch-all at root level intercepts these paths before
FastAPI can redirect to the prefixed routers, causing a 404.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
main.py
18
main.py
@@ -332,6 +332,24 @@ logger.info("=" * 80)
|
|||||||
logger.info("ROUTE REGISTRATION (AUTO-DISCOVERY)")
|
logger.info("ROUTE REGISTRATION (AUTO-DISCOVERY)")
|
||||||
logger.info("=" * 80)
|
logger.info("=" * 80)
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# EXPLICIT REDIRECTS for paths that clash with the CMS /{slug} catch-all
|
||||||
|
# =============================================================================
|
||||||
|
# The CMS catch-all /{slug} at root level intercepts /merchants, /admin, etc.
|
||||||
|
# (without trailing slash) before FastAPI can redirect to the prefixed routers.
|
||||||
|
# These explicit routes ensure clean URLs work.
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/merchants", include_in_schema=False)
|
||||||
|
async def merchants_redirect():
|
||||||
|
return RedirectResponse(url="/merchants/", status_code=301)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/admin", include_in_schema=False)
|
||||||
|
async def admin_redirect():
|
||||||
|
return RedirectResponse(url="/admin/", status_code=301)
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# PLATFORM PAGES (Marketing pages - homepage, pricing, signup, etc.)
|
# PLATFORM PAGES (Marketing pages - homepage, pricing, signup, etc.)
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user