Can we guarantee a worker will only one once per request?

With an orange clouded CNAME of aaa to bbb, this is what happens:

Request arrives for aaa -> Worker executes -> request resolves to bbb

But we also have an orange clouded A record of bbb pointing to an IP address

My question is, because this A record is also orange clouded, what is it that prevents the worker from executing again? (if indeed that is the case)

Is it because Cloudflare works like this:

Request arrives -> Run worker if entry point is orange clouded -> perform all DNS resolution (ignoring whether the rest are orange or grey)

If the record b is in the same zone (and possibly even in the same account) the Worker won’t run, it will be bypassed always (the is actually no way for it to run twice).

Also, if you don’t have the Worker set-up on the other route it will not run for obvious reasons. Set up your routes correctly and it will run only where you want it.

1 Like