Skip to content

fix: use starlette.exceptions.HTTPException for SPA fallback#14

Merged
lewisjared merged 1 commit intomainfrom
redirect
Mar 6, 2026
Merged

fix: use starlette.exceptions.HTTPException for SPA fallback#14
lewisjared merged 1 commit intomainfrom
redirect

Conversation

@lewisjared
Copy link
Contributor

StaticFiles.get_response raises starlette.exceptions.HTTPException, not fastapi.HTTPException (which is a subclass). The except clause was never catching the 404, causing the fallback to index.html to never trigger.

Also adds tests verifying the SPA fallback behavior for client-side routes, static assets, and API routes.

StaticFiles.get_response raises starlette.exceptions.HTTPException, not
fastapi.HTTPException (which is a subclass). The except clause was never
catching the 404, causing the fallback to index.html to never trigger.

Also adds tests verifying the SPA fallback behavior for client-side
routes, static assets, and API routes.
@netlify
Copy link

netlify bot commented Mar 6, 2026

Deploy Preview for climate-ref canceled.

Name Link
🔨 Latest commit 022326e
🔍 Latest deploy log https://app.netlify.com/projects/climate-ref/deploys/69aa297d3fade60008ed8e4e

@lewisjared lewisjared merged commit 6e0b479 into main Mar 6, 2026
6 of 7 checks passed
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.

1 participant