Catch-all route [...rest] at root of pages router not working on poduction build
Unanswered
Ragdoll posted this in #help-forum
RagdollOP
Hey,
I want to execute some logic on the serverside on all the routes not defined in my
So I created a
My
It works perfectly in dev mode, but once deployed on Vercel it behaves so strangely and mostly do not work
Here is what is matched depending on the path accessed:
-
-
-
-
-
I notice I get the
But I am not sure how it works, like going to
Can you help me with me with that plz ?
I want to execute some logic on the serverside on all the routes not defined in my
pages folder.So I created a
pages/[...rest].tsx file with a getServerSideProps function.My
pages folder look like this:pages/
- [tenantId]/
-- index.tsx
-- work/
--- invoices/
---- [id].tsx
- [...rest].tsx
- 404.tsx
- index.tsxIt works perfectly in dev mode, but once deployed on Vercel it behaves so strangely and mostly do not work
Here is what is matched depending on the path accessed:
-
/work => [...rest]-
/anything => [...rest]-
/work/invoices => 404-
/work/invoicesqwefd => 404-
/work/invoicesqwefd/qwesfd => [...rest]I notice I get the
404 when I have x-vercel-cache: HIT in my response headers, and I get the [...rest] page when x-vercel-cache: MISSBut I am not sure how it works, like going to
/work multiple times is always a MISS and going to a random path noone ever went to like /work/invoicesqwefdnotprobabbllluuyuuuu is a HIT from the first time (and alway after too).Can you help me with me with that plz ?