Skip to content

Commit b9326ab

Browse files
Arpith Siromoneyclaude
andcommitted
Fix static asset routing with explicit pass-through rules
Add wildcard rules for static assets (*.css, *.js, *.png, etc.) before the /:user catch-all to prevent redirects from overriding static file serving. Reference: https://developers.cloudflare.com/pages/configuration/redirects/ "Redirects are always followed, regardless of whether or not an asset matches the incoming request" Fixes: - /style.css now serves CSS instead of user.html - /login redirects to /login/ instead of /user - All static assets properly served 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 02f7d82 commit b9326ab

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

static/_redirects

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
# Redirect /api to the API server
1+
# External redirects (highest priority)
22
/api https://api.feedreader.co 301
3-
4-
# Bookmarklet redirect
53
/bookmarklet/js /bookmarklet.js 301
64

7-
# Preserve existing links - redirect to folders (before /:user catch-all)
5+
# Static assets - pass through (prevent catch-all from matching)
6+
# Reference: https://developers.cloudflare.com/pages/configuration/redirects/
7+
# "Redirects are always followed, regardless of whether or not an asset matches"
8+
/*.css /*.css 200
9+
/*.js /*.js 200
10+
/*.png /*.png 200
11+
/*.ico /*.ico 200
12+
/*.icns /*.icns 200
13+
/*.json /*.json 200
14+
/*.xml /*.xml 200
15+
/*.txt /*.txt 200
16+
17+
# Folder redirects - preserve existing links
818
/login /login/ 301
919
/signup /signup 200
1020
/help /help/ 301
1121
/welcome /welcome/ 301
1222
/settings /settings/ 301
1323
/bookmarklet /bookmarklet/ 301
1424

15-
# SPA routing - serve HTML files for dynamic routes (most specific first)
25+
# SPA routing - dynamic routes (most specific first)
1626
/articles/:id/body /article 200
1727
/articles/:id /label 200
1828
/:user/labels/* /label 200
1929
/:user/folders/* /label 200
2030
/:user/feeds* /label 200
2131
/feeds/* /label 200
2232

23-
# User pages - catch-all for usernames
33+
# User pages - catch-all (MUST be last)
2434
/:user /user 200

0 commit comments

Comments
 (0)