Redirect loop when setting both page rules and transform rules for the same hostname

I tried the new transform rule for dynamic url rewriting today by concating request pathname to my b2 bucket name( concat("/file/b2-bucket",http.request.uri.path). This worked perfectly until I added a page rule for the same hostname. Since the request was returning a cache-control of max-age:0 , I setup a page rule for browser cache and edge cache (*). After I enabled the page rule the request is timing out with an error “too many redirect”. (…)

Transform rule : Imgur: The magic of the Internet
Transform & Page rule :

PS: I know I can set cache control at backblaze. I just want to know why this didn’t work

Hi there,

This is very tricky to advise without looking at your specific configuration and potentially providing details about your domain that you wish to keep private.

I would recommend raising a support ticket with a breakdown of configuration you had in place and detailed steps about how to replicate this problem you saw. We can then review your case and try advise on where there is a problem.

Keep in mind that Cloudflare will not do redirects unless you have a ‘Forwarding URL’ page rule or are using Cloudflare Workers to do redirects - so it is likely that the redirect would be coming from the origin and you just need to identify how the request is being transformed and passed to your origin server and then replicating that request to your origin to see how it behaves.

Thanks for the reply. I fixed it. The problem was with the ssl settings set to flexible. When I changed it to full mode, it worked. But I still don’t know why it was happening only when a page rule is added (no ssl settings was changed. Only for changing cache headers)

1 Like

If you are using linux/macOS or you download curl for windows you can run this command:

curl -svo /dev/null --connect-to ::IP Address

Replacing the URL with your site and how the transform URL/Page rule is achieving and replacing the IP address with your server IP. (nb. using http:// because of Flexible SSL) and that should show you how your origin was responding to those requests.

You may have had another page rule in place that was setting Full. As only one Page Rule will trigger for any request, the new page rule executed, and the previous SSL Mode was not correctly set.

There was no other page rules other than this one.

Origin server was redirecting from http to https. I noticed that and changed the ssl settings. What I don’t understand is that how come it didn’t affect before adding a page rule. As I mentioned above ssl settings was not changed in page rule and ssl mode was set to flexible globally. No other page rules was added to change the ssl settings. Anyway the problem is fixed. Thanks for the help.

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