rotator
rotator
CDCloudflare Developers
Created by abelsj60 on 8/8/2023 in #workers-help
Pages, Workers, Remix
My understanding is that /build contains all the Remix code.
/build contains just the static assets (front-end only), that's why we want to exclude it from being routed through the backend. functions/[[path]].js is the entrypoint of your Pages functions application. >"exclude": ["/favicon.ico", "/build/*"] means "Exclude these files from being routed through Pages functions".
In other words, dynamic content on home ("/") is just going to have to run through the Worker at a cost, no matter what I do?
Yes, "dynamic" means that the (HTML) content is generated server-side at request time. That's going to be more expensive than just serving static assets.
5 replies
CDCloudflare Developers
Created by abelsj60 on 8/8/2023 in #workers-help
Pages, Workers, Remix
Interesting question, I think this https://developers.cloudflare.com/pages/platform/functions/routing/#functions-invocation-routes answers it for the most part
On a purely static project, Pages offers unlimited free requests. However, once you add Functions on a Pages project, all requests by default will invoke your Function.
For Remix specifically, right now every single request goes through Pages functions, so every visit to your site + all subrequests to fetch CSS/JS/etc. assets are billed as a Worker requests. This is actually a bug in Remix and static assets should go directly to Pages. It seems like you can work around this, check out this issue on GitHub https://github.com/remix-run/remix/issues/4569 With the fix/workaround, only direct hits will be billed as Worker requests (the requests that generate HTML and return to the browser).
5 replies