From 2bc2fc5bfea54b15521e570452bcd985b7bd4a3a Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 14 May 2021 20:35:24 -0700 Subject: [PATCH] Don't handle /outfits/new with SSR Right, the routes are a bit confusing, `/outfits/new` matches `/outfits/:id`, but shouldn't. I fix this at the routing level, by creating a more specific `/outfits/new` route that matches first, and just serves `index.html` right from the CDN. To check that it's exact, I check for either a `?` or the end-of-string after `new`. That way, `/outfits/newish` correctly redirects to the SSR. (This doesn't actually matter a lot, because outfit IDs are only ever numbers and therefore can't start with "new"? But I figure, better to have an unambiguous semantic, then leave random things relying on outfit ID format assumptions.) --- vercel.json | 1 + 1 file changed, 1 insertion(+) diff --git a/vercel.json b/vercel.json index d941085..1858cf7 100644 --- a/vercel.json +++ b/vercel.json @@ -1,5 +1,6 @@ { "routes": [ + { "src": "/outfits/new(\\?|$)", "dest": "/index.html" }, { "src": "/outfits/(?[^/]*)", "dest": "/api/outfitPageSSR.js?id=$id" }, { "handle": "filesystem"