APO + Always Use HTTPS creates a duplicate redirect

This is more of an FYI but you may want to check if you have APO and Always Use HTTPS both turned on. I usually put the necessary redirects in .htaccess, which works fine with no duplication issues. But I thought I would try issuing them via Cloudflare for a small performance gain. Then I noticed this issue and have raised a support ticket #2048565. Waiting to hear back. I thought I could turn Always Use HTTPS off and use a page rule instead for the WWW (no https) but as long as APO is turned ON, page rule doesn’t seem to have any affect. I use https://varvy.com/tools/redirects/ to map the redirects. While the duplicate redirect does ultimately resolve correctly, this can’t be good for performance (even if it is just a small hit).

I see it looks like it puts the trailing slash on during the HTTPS redirect, and then redirects to remove the www. So it’s not a duplicate redirect. It’s just inefficient.

Whereas without www, it redirects to https and adds the trailing slash at the same time.

Maybe @yevgen can take a look at the ticket you mentioned.

1 Like

For most websites, this is a non-issue. You have your canonical URLs performing correctly (no redirects) and that’s what matters. If you’ve done your SEO properly, your URLs should already contain the correct protocol in Google and other search indexes, as well as in all links within your site. So most people will reach the canonical URL, and only a negligible few will ever type in your domain address onto a mobile browser’s address bar. (As a site admin, you may do this all the time, but your website users? nah…) That’s why one should always test the speed by providing the correctly formed URL to test sites such as GTMetrix, webpagetest.org etc.

The exception of course is if your site has been around for a long time, and has many links pointing to it from other websites with the old, non-secure http protocol. In that case you need to chose between the performance degradation a double redirect at the Cloudflare edge causes, vs what would happen if all such requests were sent in to your origin server and only then trigger the .htaccess rule you mentioned. You can always test both and, considering how spread your target audience is globally, pick whatever best suits your site.

1 Like

While I agree the whole “too many redirects” is generally a non-issue, APO seems to cause an extra redirect. It may unintentional and something the devs may want to correct.


There is no redirect logic in APO worker. Please confirm that disabling APO makes any difference in the redirects mapping.

Appears it is Always Use HTTPS not APO.
Tested with APO both on and off and got the same result.

But if I turn Always Use HTTPS - OFF and turn APO - ON … the no www is missing

I tried to restore the missing redirect above using a forwarding page rule but it doesn’t make any difference, the no www redirect is still missing.

that’s for the report, I will investigate APO integration with a redirect page rule.

Thanks, maybe also consider the 2 redirects with Always Use HTTPS.

If you’re talking about ‘www’ and ‘https’ redirects, that’s not something unique to APO, and is the subject of @cbrandt’s response. It’s also covered in many posts here regarding GT Metrix’s “redirects” warnings.

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