Thanks @Walshy - after i deploy the

Thanks @Walshy - after i deploy the worker, how would i trigger it for all vanity domains honstnames only? The image p asted shows the Routes but im unsure what to put there ,so that it doesn't trigger on every request, but rather only vanity domains (i.e. where hostname !== 'my-domain.com' OR as your script above shows I need to run it on every single request? and do that check in the worker? (Seems like a extra hop now my domain needs to take) Also if i enter *, it will trigger on all static asset requests as well (which is not necessary) --
No description
3 Replies
Walshy
Walshy•5mo ago
You'll need to do * unfortunately unless you add each customer as a route but that doesn't scale well
Ricky U
Ricky UOP•5mo ago
Yup that wont scale... if I add , it triggers the worker on every single request, and i mean every single .js download, img download, cdn download.. so this isn't going to work, and my bill will 🚀 .... so for now im mostly handling the redirection in my client side code (not ideal) ...
for now i want to try something simpler redirect sitemap.xml for vanity domains only... so in the Route i tried *
.mydomain.com/sitemap.xml (assuming this would run everytime for all my hostnames including my pages domain was hit with a path of sitemap.xml) but it only works for my pages domain and none of my sitemaps... do i need to do */sitmap.xml (that doesnt seem to be accepted)
Walshy
Walshy•5mo ago
if this was workers assets, you could use inclusion/exclusion rules in run_worker_first - https://developers.cloudflare.com/workers/static-assets/binding/#run_worker_first

Did you find this page helpful?