Cloudflare / LiteSpeed Cache Redirect Loop w/ UTM




Wordpress LScache Plugin: Cloudflare / LiteSpeed Cache Redirect Loop w/ UTM

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hello Having issues with ignored query strings causing redirect loops with Cloudflare Same issues as outlined here https://community.cloudflare.com/t/litespeed-cache-works-but-after-some-time-site-gets-to-redirect-into-redirect-loop/298082 Ive disabled the proxy and SSL settings in Cloudflare with no resolution. It has occurred on two of my sites with heavy traffic older versions can be found at the bottom of this page https://wordpress.org/plugins/litespeed-cache/advanced/ I currently dont even use Cloudflare proxied, just for DNS and the issue is still present. SSL settings are also disabled in Cloudflare which apparently could be a reason why the issue is happening I do have forced SSL enabled on my server, which may resolve the issue but what happens if someone visits the http version without a redirect? Unsecure ts because im using cloudflare and litespeed together Correct, LiteSpeed actually supports adding Cloudflare credentials into the app so this issue shouldnt be occurring I havent noticed the UTM tags being removed after visiting the site before What I know so far, is the redirection loop is caused by queried tags (UTM tags), usually from ads or newsletters (possibly for long strings with UTM campaigns, medium, and sources), and a forced SSL redirect loop when LiteSpeed & Cloudflare are used in conjunction even if Cloudflare proxy is disabled. The issue occurs randomly and is resolved once the cache is cleared which leads me to believe it can be resolved by LiteSpeed cache. Nope, do you recommend installing the older version? so far so good for me, 4.6 working like a charm, i probably wont ever move from this version.. how did you go? Still having issues, I just downgraded to 4.6 so hopefully it resolved it for the time being Fingers crossed the team resolve this issue in the next version please try this code to themes functions.php it will retain the caching , but only make redirection request to no-cache add_filter( wp_redirect, lscwp_redirect_check, 10, 2 ) function lscwp_redirect_check( $location, $status ) do_action( litespeed_control_set_nocache, no cache on redirection ) return $location see if it helps. Only issues is its the site is flooded with traffic from a campaign and its set to no cache it could cause the site to go down? if the redirection was like domain.com -> domain.com/?utm_xxxxxxxx , I wonder who made that redirection the cache plugin itself doesnt redirect , but something else did that but LSCWP cached , unwantedly and do you see a lot of 301/302 on access log when flooded ? I assume Cloudflare has something todo with it, because everyone seems to be using it. Mine is completely unproxied though so its confusing as towards why it would matter The loop most likely is http -> https -> http -> https, it has something todo with ssl okay , now we are getting somewhere please try search in database and site files on key word http or better http:// and update them to https:// then purge all I dont have any that are http, I believe maybe when a link is attached in campaign as http:// it causes an issue So if I put http:// in a newsletter with utms it would cause an issue Just to note, most queries are ignored as well via LSC function lscwp_redirect_check( $location, $status ) if (strpos($_SERVER[SCRIPT_URI], https:// ) !== false && strpos($location, http:// ) !== false ) do_action( litespeed_control_set_nocache, no cache on redirection ) return $location what about disable redirection cache from https:// to http:// Is this okay? function lscwp_redirect_check( $location, $status ) if (strpos($_SERVER[SCRIPT_URI], https:// ) !== false && strpos($location, http:// ) !== false ) if ( strops($_SERVER[QUERY_STRING], utm ) !== false ) do_action( litespeed_control_set_nocache, no cache on redirection ) return $location This support topic became like a blog post, with people posting many things not necessarily related to this plugin or the support topic. I have archived those 3 pages of comments. If you need support then per the forum guidelines please start your own topic. https://wordpress.org/support/forum-user-guide/faq/#i-have-the-same-problem-can-i-just-reply-to-someone-elses-post-with-me-too You can do so here. https://wordpress.org/support/plugin/litespeed-cache/



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference