-
Hi Next.js Community! I've been playing around with Next.js for some time now and I really enjoy the 'easyness' of working with it! I've got a domain where all the pages are practically dynamic with dynamic content loaded from a headless cms. So the folder structure I've got looks like the following:
With this I'm expecting to get all the Some code that might come in handy; (This is from the [uid].tsx)
Thanks in advance! :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Catch all routes are very aggressive, and a top level catch all route will indeed, catch absolutely everything. In your case a request for a service worker is arriving at Next.js. Say for example that there's no The catch all route, will then kick in and Again, in your case, the browser seems to have saved a service worker and it is making a request to get it. You ought to be extremely careful with catch all routes at the root of the application, as they'll swallow most things. You can use the |
Beta Was this translation helpful? Give feedback.
Catch all routes are very aggressive, and a top level catch all route will indeed, catch absolutely everything.
In your case a request for a service worker is arriving at Next.js.
Say for example that there's no
public/favicon.ico
file available in yourpublic
folder.The catch all route, will then kick in and
uid
will befavicon.ico
.Again, in your case, the browser seems to have saved a service worker and it is making a request to get it.
You ought to be extremely careful with catch all routes at the root of the application, as they'll swallow most things.
You can use the
resolvedUrl
in thegetServerSideProps
handlercontext
, to decide whether or not you are faced with a valid request. …