LiteSpeed Cache for XF2 - Community

LiteSpeed Cache for XF2 - Community 2.3.0

No permission to download
This isn't valid/present anymore on XF 2.1 though, based on my own install testing.

I had seen the same on our server but I was testing as logged-in since we do not have the style select feature available for guests.

I did confirm that the cookie was set on Jon12345's site when I visited as a guest but it's possible he is on 2.0(?).

Did you do your testing as a guest @rdn ?

Thanks,
-Michael
 
  • Like
Reactions: rdn
I get "HTTP ERROR 500" When i update .htaccess with the code that you refer on your plugin page.
Do i have to update .htaccess file in order to get this plugin work?

I am using latest xenforo version


I added following code into .htaccess file (begining line)

# LiteSpeed XenForo cache
<IfModule litespeed>
CacheLookup public on
RewriteEngine On
# cache
RewriteCond %{HTTP_COOKIE} !(xf_lscxf_logged_in|xf_user|xf_session_admin) [NC]
RewriteCond %{REQUEST_URI} !/install/ [NC]
RewriteRule .* - [E=Cache-Control:max-age=360,E="cache-vary:xf_style_id,xf_language_id"]
# no cache
RewriteCond %{HTTP_COOKIE} (xf_lscxf_logged_in|xf_user|xf_session_admin) [NC]
RewriteRule .* - [E=Cache-Control:vary=loggedin,E=Cache-Control:no-cache]
</IfModule>
 
I get "HTTP ERROR 500" When i update .htaccess with the code that you refer on your plugin page.
Do i have to update .htaccess file in order to get this plugin work?

I am using latest xenforo version


I added following code into .htaccess file (begining line)

# LiteSpeed XenForo cache
<IfModule litespeed>
CacheLookup public on
RewriteEngine On
# cache
RewriteCond %{HTTP_COOKIE} !(xf_lscxf_logged_in|xf_user|xf_session_admin) [NC]
RewriteCond %{REQUEST_URI} !/install/ [NC]
RewriteRule .* - [E=Cache-Control:max-age=360,E="cache-vary:xf_style_id,xf_language_id"]
# no cache
RewriteCond %{HTTP_COOKIE} (xf_lscxf_logged_in|xf_user|xf_session_admin) [NC]
RewriteRule .* - [E=Cache-Control:vary=loggedin,E=Cache-Control:no-cache]
</IfModule>

Howdy @youbu ,

I've taken the rules you posted and pasted them into our forum's .htaccess file without running into any issues (5xx errors or otherwise).

It's possible that there is a rule conflict causing an issue on your site. If you'd like to submit a ticket with us we can help you figure out whats going on.

Regards,
-Michael
 
I was waiting that update, thanks
I was disabled the fastcgi cache because of that guest page caching issues when have multi style.

Thanks
 
I think with this latest update, you'll need to include "xf_style_id" cookie as a non-cache cookie. Otherwise, you'll have different styles cached for different pages depending on when they were loaded.
 
Last edited:
just in time.... I actually just noticed this condition. Thank you.

What is ahead on the roadmap for this add-on ?

As of right now, nothing new on the roadmap, mostly due to other company projects taking priority. We are always open to suggestions though, and keep a running list.

I think with this latest update, you'll need to include "xf_style_id" cookie as a non-cache cookie. Otherwise, you'll have different styles cached for different pages depending on when they were loaded.

I'm not sure what you mean by this @arn . The idea IS to have different cached copies per style so that a guest who selects a different stlye can still be served from cache in that style. Without this vary everyone would get served whichever style was selected when the page was first cached.

Perhaps I'm not understanding what you mean by "depending on when they were loaded".

Thanks,
-Michael


Edit: On a re-read of your post I think I see the misunderstanding now. In the .htaccess rules for this plugin we vary cache on both language and style. So for page X, a cache copy can exist for "English + Style_1", "English + Style_2", and "French + Style_1" all at the same time ensuring that visitors get served the correct combination matching the values set in those cookies.
 
Last edited:
Where can I get 2.2.1? This new version (even the fix you posted) seems to create a lot of problems on my website...
 
Edit: On a re-read of your post I think I see the misunderstanding now. In the .htaccess rules for this plugin we vary cache on both language and style. So for page X, a cache copy can exist for "English + Style_1", "English + Style_2", and "French + Style_1" all at the same time ensuring that visitors get served the correct combination matching the values set in those cookies.

Ah yes... you're right, I didn't see that.

RewriteRule .* - [E=Cache-Control:max-age=360,E="cache-vary:xf_style_id,xf_language_id"]
 
Is Anyone know how apply that or similar rule for nginx ?
RewriteRule .* - [E=Cache-Control:max-age=360,E="cache-vary:xf_style_id,xf_language_id"]

Because i'm trying to using that plugin for cookie control on nginx fastcgi cache implement.

In nginx, i'm experiencing the wrong cache issues between light and dark styles... (some pages caching in dark mode even default style is light mode)
 
Is Anyone know how apply that or similar rule for nginx ?


Because i'm trying to using that plugin for cookie control on nginx fastcgi cache implement.

In nginx, i'm experiencing the wrong cache issues between light and dark styles... (some pages caching in dark mode even default style is light mode)
I'm not familiar with nginx, but quick google makes it not clear how to vary on the cookie

Alternatively, you can add xf_style_id cookie in the same place you have "lscxf_logged_in" to bypass caching. In which case, your default theme will be cached for guests, but not if they customize it. Which is a fair tradeoff if the vary thing is hard to get done.
 
I'm curious about what kind of problems you are seeing? Not much has changed from v2.2.1 to v2.2.2.

For example: If I change the default theme and logout, that change is not reflected and guests will still be presented the old theme. That did not happen in the previous version.
 
For example: If I change the default theme and logout, that change is not reflected and guests will still be presented the old theme. That did not happen in the previous version.

Changing theme won't trigger a cache purge so you might need to wait for cache to expire before it takes effect. The behavior for that has not changed between versions. If you you haven't switch back to v2.2.1 yet, I'd suggest doing the same and visiting an older page incognito to see if it behaves how you'd expect.

Regards,
-Michael
 
  • Like
Reactions: arn
Top Bottom