abelsj60
CDCloudflare Developers
•Created by abelsj60 on 8/8/2023 in #workers-help
Pages, Workers, Remix
I'm doing some development work on a website with Remix.
BACKGROUND
Remix does not use static rendering, but rather builds pages via server-side rendering. This is accomplished via a
loader
function that receives "get" requests.
I am planning on having dynamic content on the home page (text + images, all of which is currently slated to be stored in a simple .json file).
I will be selecting this content randomly whenever a request comes in. In essence, each load will randomly load one of eight possible stories.
QUESTIONS
A. What does this sort of dynamic content mean for my use of Cloudflare Pages / Workers?
- It may seem obvious, but I am not sure if this means that every home page loader
will trigger a Worker or not?
- If a Worker is triggered, then my projected cost calculation is different than if it is not triggered?
B. Similarly, Remix action
functions will receive mutations from each page (post, patch, delete...).
- If I have a form on a page that sends a "post" method to one of my project's route actions
, does that mean a Worker will be triggered to handle the action
?
- If so, this also means that my project's projected cost calculation will be different than if the Worker were not triggered?
Appreciate the clarifications — it's currently hard for me to understand the boundaries between Pages and Workers.
Understanding this could be an important factor in terms of the features I plan and the ways in which I write my code.5 replies
CDCloudflare Developers
•Created by abelsj60 on 8/8/2023 in #workers-help
Problems redirecting to a custom subdomain for a 'deploy' branch
I have a feeling this is futile, but this is what I'd like to do:
GOAL
- I have a branch with an alias for a very small Remix project (basic Web site).
- I have this branch locked down via the initial Zero Trust policy — I have to get an email with a pin to access the branch deployment.
- I'd like to put a redirect a subdomain from my custom domain to it.
- For instance, I want to point staging.my-domain.ai to alias-name.repo-name.pages.dev
- I also want to add two names to my Zero Trust policy to allow them to access this staging branch with a pin, too.
CURRENT STATUS
- The DNS records are managed by a domain registrar. I'd rather not transfer — it'll be a pain in the neck.
- I already have Cloudflare serving the production branch to the custom domain (I've configured CName records, as per directions).
- I then made a new CName record with "staging" as my host and as the value.
- I set up a custom domain in Cloudflare, ran the DNS check, and eventually saw the dashboard report the name active.
But, wah-wah...
I think Cloudflare is redirecting to the production branch. There's a note in the docs suggesting this may happen, but I'm learning as I go and that note wasn't totally clear to me until I gave it all a whirl.
HELP?
Is there any way to make this work without transferring the DNS to Cloudflare?
If I were just starting this part of the project, that'd be fine with me, but, given that this part is set up and development is still a work in progress, I'm not ready to make a more drastic change on this front.
Are there any other recommendations of an approach to try?
5 replies