-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: cloudflare routing 404 #870
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Let me merge #866 first. |
Wow. #866 is an exciting PR. I will rebase and see if I can finish the rest of the cloudflare routing updates needed here. |
eab674c
to
54c61b2
Compare
54c61b2
to
bece48d
Compare
bece48d
to
c5d993d
Compare
I updated the _routes.json to always start with "/assets/*" in the exclude and then walk the public directory and add the rest of the files, replacing I noticed a couple new issues while working on this.
|
Could you please link to the docs for the cloudflare path support? |
c5d993d
to
8be63d2
Compare
No problem! https://developers.cloudflare.com/pages/configuration/serving-pages/ |
Here are other docs to reference. We are using "advanced mode" so everything routes through a single There is also additional relevant documentation here. Once advanced mode is enabled, a _routes.json file is required to split dynamic routes that are handler by the worker function and static routes that should be served off the CDN. https://developers.cloudflare.com/pages/functions/routing/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test it, but looks fine to me. Can I merge?
lgtm. Thanks for the docs and the change @rmarscher ! |
Thanks for confirming. |
Thank you! |
This fixes cloudflare static vs dynamic routing for the home index page. But there are likely more bugs with the _routes.json when trying to nest a dynamic route under a static route path. By using _routes.json, we can route static html files directly off Cloudflare's CDN and not incur any worker function changes. But we need to make sure it only matches the static html routes.
Right now, it is doing a very basic walk of the public output dir to generate a _routes.json. We need to generate a more accurate list of exclude patterns. I am opening this PR as a draft until I can complete this. Fixes #869