Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

Bugfix: 200 rewrite reaches its file when the request has a query string #95

Merged nekomimi.pet
targeting main from byjp.me/wisp.place-monorepo:fix/rewrite-query-string
Merged opened by and assigned to nekomimi.pet
targeting main from byjp.me/wisp.place-monorepo:fix/rewrite-query-string

Hey there! I think I've found a bug in the _redirects logic. There's a repo site up at https://sites.wisp.place/byjp.me/redirects-repro/ and some links below that show the issue.

Currently matchRedirectRule appends the request's query to 200/301/302 targets. This means that a _rewrites file like this:

/* /index.html 200

Would take https://example.com/stuff?a=1 and look for the file called /index.html?a=1 (rather than looking for /index.html). This breaks query parameters on SPA sites today (a problem for things like ?utm_whatever which gets added automatically by some sites 🙄).

Path On main today After this PR
/stuff 200, index.html 200, index.html
/stuff?a=1 🚨 404, wisp's not-found page 200, index.html
/?a=1 200 200

To fix this I updated internalRedirectPath, which every internal lookup goes through, so it now drops the query. (This also means that manifestHasPage, which was already stripping query params, no longer needs it.)

Commits 0