Page rule validation should check other page rules

Use case: Redirecting all pages to a maintenance page with a 302 redirect.

I created a page rule for the target (maintenance page) URL with some caching settings, to avoid looping, saved it as “Last”.

Then I created the Forwarding URL page rule with source

example.com/*

and target

example.com/maintenance-page/

And also tried to save it as “Last”, in which case this would be the real last position, and so it would not apply to the maintenance page itself, due to the previous page rule above.

I got the following error message:

Page Rule validation failed: See messages for details. (Code: 1004)

And the message it refers to was:

Forwarding URL matches the target and would cause a redirect loop

I believe this could be improved by making sure the validation process check if there is a page rule for the target URL and that it is properly positioned (i.e., before the /* page rule).

Also, a mechanism could be developed to prevent toggling on the redirects if afterwards the user moves the positions of the rules in a way that would cause the looping.

1 Like

Bumpity bump :slight_smile:

Have been aware of this issue since forever :smile: but just came across it again in the context of Forwarding URL Help.

IMHO, it doesn’t even need additional logic but just

  1. run the check as right now
  2. if the system determines a loop, show a warning and a force checkbox
  3. if the user checks the box, skip the check on on the next save

I actually somehow managed to set that up in the context of that thread, but have no way of reproducing that now.

4 Likes