Replace nginx rules with worker or transform/pages rules

Hi, I have some nginx rules like this ones:

location ~ ^/governance/period/[0-9a-z\-_]+$ {
   try_files $uri $uri/ /governance/period/index.html;

location ~ /tx/(.+)/inner-tx/(\d+) {
    try_files /tx/slug_id/inner-tx/index.html =404;

location /tx/ {
    try_files /tx/index.html =404;

the problem I have trying to do it with a transform rule is that I don’t have multiple options I mean, for example, rule ^/governance/period/[0-9a-z\-_]+$ first try the same uri, then uri/ and last /governance/period/index.html if I do this with a worker I would need to handle the returned 404 and based on that continue trying options, any alternatives or best way to solve this?

Workers are great for any complex redirects or rules but you’ll be paying on a per-request basis.

Have you looked at Bulk Redirects?

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.