Cloudflare / LiteSpeed Cache Redirect Loop w/ UTM
-
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
I’ve 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
I currently don’t 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 shouldn’t be occurring
I haven’t 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 theme’s 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 it’s the site is flooded with traffic from a campaign and it’s 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 doesn’t 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 it’s 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
httpor betterhttp://and update them tohttps://then purge allI don’t 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.
You can do so here.
https://ww.wp.xz.cn/support/plugin/litespeed-cache/
The topic ‘Cloudflare / LiteSpeed Cache Redirect Loop w/ UTM’ is closed to new replies.