fix: mount /static before ui.router to prevent wildcard route catching static files
The ui.router's /{username}/{persona} wildcard was matching /static/style.css
(username="static", persona="style.css") because app.mount("/static") was
registered after app.include_router(ui.router). FastAPI processes routes in
registration order, so /static must be mounted first.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,14 +35,16 @@ app.include_router(distill.router)
|
||||
app.include_router(auth.router)
|
||||
app.include_router(orchestrator.router)
|
||||
|
||||
# Static files — must be mounted BEFORE ui.router so /static/* is matched first.
|
||||
# ui.router has a wildcard /{username}/{persona} that would otherwise catch /static/style.css etc.
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
# Onboarding (invite tokens + persona creation — before ui.router)
|
||||
app.include_router(onboarding.router)
|
||||
|
||||
# UI router (login + /{user}/{persona} — must be last to avoid swallowing API paths)
|
||||
app.include_router(ui.router)
|
||||
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health() -> dict:
|
||||
|
||||
Reference in New Issue
Block a user