Worker OK in Preview but not from web

Hi, I have a worker which will intercept requests to an origin and return a response from a request to a different url. It works fine in preview and testing mode but when invoked from the web, the worker does not trigger and the origin response is displayed. I have configured this on records on two different domains with the same result. Both records are ‘orange’. Is there a switch somewhere that I need to flick to make the worker ‘live’? Thanks in advance for any help

I think I’d briefly been caught by this… before I remembered to set up a route. Is that in place and of the proper format?

Thanks. Yes route is setup and in the form “foo.domain.com/*” and my requests are “foo.domain.com/bar”. The only thing I can think of is there is some issue with Workers where “foo” is a CNAME for a 3rd party HTTPS protected site which in my case is a Google GCP Function. I am basically proxing in the Worker to my Google GCP Function in order to get a user friendly domain.

My issue was that a route “bar.domain.com/” doesn’t match requests like “foo.bar.domain.com/baz”. So I have Workers working now but only for requests like “bar.domain.com/baz” using a route like “bar.domain.com/”. I think that this is just an issue with the Cloudflare site certificate not supporting multi level subdomains

Add a leading asterisk - *bar.domain.com, with no leading dot.

That’ll match bar.domain.com and foo.bar.domain.com.

Trailing asterisk works as you expect, so if you want all subdomains and all paths: *bar.domain.com/*.

1 Like

Thanks Michael, I have it working, the issue was that the free certificate from Cloudflare does not support multi-level domains, I needed to buy a multi-level cert for $10 per month from ‘Crypto/Edge Certificates’

2 Likes