Wordpress LScache Plugin: Reload Loop on 2nd domain name after added Allow-Origin
Last Updated on: Wed, 15 Apr 2026 00:00:02 After adding Access Orgin in htcaccess for 2nd domain this starts a redirect loop on that domain. Im trying to figure out how to fix this. The original URL works and the new domain looks like working but it reloads infinity every second. The 2nd URL works normally when the LS plugin is Off/Complete Debugmode. # START ALLOW OTHER ORGINS Header set Access-Control-Allow-Origin https://MYURL.MYURL.se Header set Access-Control-Allow-Credentials true # END ALLOW OTHER ORGINS Any ideas? The page I need help with: https://businesscards.3on.se/a/viktor-grahn Hi to myself! I think I found the issue, I was turned off Guest mode caching. I was found the issue but still Guest mode caching is making a big improvement on site so it good if its possible to get this to work. Access to fetch at https://mysite.io/wp-content/plugins/litespeed-cache/guest.vary.php’ from origin https://my.newsuburl.com’ has been blocked by CORS policy: No Access-Control-Allow-Origin header is present on the requested resource. If an opaque response serves your needs, set the requests mode to no-cors to fetch the resource with CORS disabled. Adding this but then I get a redirect loop: # START ALLOW OTHER ORGINS Header set Access-Control-Allow-Origin https://my.newsuburl.com Header set Access-Control-Allow-Credentials true # END ALLOW OTHER ORGINS Any idea? cache-control: max-age=3, must-revalidate try make it max-age=0,no-cache, must-revalidate Hi, I was trying to add this: SetEnvIf Origin ^(https?://(?:.+ .)?mysite .com(?:: d 1,5 )?)$ CORS_ALLOW_ORIGIN=$1 Header append Access-Control-Allow-Origin % CORS_ALLOW_ORIGIN e env=CORS_ALLOW_ORIGIN Header merge Vary Origin Header set Cache-Control max-age=0, no-cache, must-revalidate Still the same issue. https://ek___.io/wp-content/plugins/litespeed-cache/guest.vary.php where did this URL comes from ? and the page URl is https://b____.3on.se/a/viktor-grahn/ Now I have deactivated Origin htcaccess fix so the layout is broken in subsite with error message in Chrome console. This is the main site (working): https://ek____.io/a/viktor-grahn/ And this is my subsite/ mirror site I added with Domain alias in eko___.io Webhosting + Domain mapping plugin in WP: https://hi.3on.se/a/viktor-grahn/ (I can remove URL after you seen this) Can I somehow get Guest Cache to work on subURL or how can I disable Guest Cache only on other Origin domains? I see the issue is the guest.vary.php was coming from ek?.io domain , so it (tries to) redirects it back to ek?..io , while the page retained on https://businesscards.3on.se and then end up in loop try add this code to your wp-config.php , at top of it if (strpos($_SERVER[HTTP_HOST], businesscards.3on.se ) !== false) define( LSWCP_PLUGIN_URL, https://businesscards.3on.se/wp-content/plugins/litespeed-cache/ ) Hi, Now I think I got it to work, one problem with looping redirect was also the mapping plugin I was installed before, I removed this and added below code + Origins code in htcaccess: $allowed_hosts = array(hi.3__.se, foo.newsubexample.com) if (strpos($_SERVER[HTTP_HOST]) || !in_array($_SERVER[HTTP_HOST], $allowed_hosts)!== false) define(LSWCP_PLUGIN_URL, https://hi.3__.se/wp-content/plugins/litespeed-cache/) Update: Now I have removed code in htcacess and it works with only the code in wp-config. Now all my original site works from hi.3__.se . Can I block so only the URL I choose works on the subsite? For example, if I want only hi.3__.se/abc to work and the rest redirects to the original site home https:://eko___.io/ . the thing here is that you need to fit the domain URL in that LSCWP_PLUGIN_URL when you access from different domain , so you need that define in wp-config to pre-define it before LSCWP itself defines it yes , you can use rewrite rule to redirect non-abc to your site.
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference