Page rule redirects not working for domains with workers

looks like page rules are not working if a domain has the worker attached; when i detach a worker the page rules (302 redirect starts working again).

it appears that one redirect rule does work with workers but not more than 1

Are you saying that you want to redirect a request and have a Worker respond to it?

No i want to redirect a request before worker responds to it. Only one of 3 page rule redirects seems to work when the worker is assigned to the domain.

/path1 - > redirect
/path2 -> also redirect
/Path3 -.> also redirect
/Rest go to worker

If your Worker Route is example.com/* so you can catch the rest of your paths, you can create Null Workers for those other paths. Here’s what I do, and Workers automatically prioritizes the routes:

  1. /* to do a Cache Everything type of Page Rule, but with a Worker for better control.
  2. wp-admin needs a special CSP, so I freshen those up and shouldn’t be cached.
  3. wp-login set to Null (no script) because my Cache Everything worker messes up wp-login.

Sure but this goes against your worker quota ? vs page rules should* redirect before it hits the workers

I don’t think Page Rules fire before Workers are executed.

1 Like

I have a similar issue, Im using the cache API within my worker, and I also have some bypass cache page rules set up.

Since the cache in handled in my worker it is just ignoring my page rules, I had to specify bypass rules in my worker code (which is not ideal). As I understand the worker runs first and then the page rules?