Litespeed cache htaccess rules or phpbb extension

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Scam Warning
Post Reply
User avatar
STN
Registered User
Posts: 50
Joined: Sat Sep 04, 2010 8:25 pm
Contact:

Litespeed cache htaccess rules or phpbb extension

Post by STN »

Hello,

I use a webserver called Litespeed and it has a thing called Litespeed cache. What it does is cache the whole page including dynamic pages so there's no need for processing php/mysql which really speeds things up and make server able to handle a lot of requests.

The idea for a forum is to cache content for non-logged in users since guests can get away with seeing static/somewhat stale content whereas it's bypassed for logged in users as obviously registered users need to make posts/login etc and see fresh content the moment they post or browse.

They have made an extension for xenforo which basically sets a cookie for pages that xenforo itself doesn't produce a cookie for (e.g search) , so those pages can be excluded from cache and then with htaccess, sets cacheing rules for guests pages. It's quite simple actually once you see what it's doing. Rest of the stuff is taken care by litespeed server itself.

https://xenforo.com/community/resources ... nity.6248/
(it's free, you just need to register).

Unfortunately, they don't have anything for phpbb. No htaccess rules or an extension which would make sure that problematic pages like login/register/search etc are not cached. I don't know much htaccess so not sure how i would do it myself and if it's even possible with htaccess without needing an extension.

I am sure for people who know how phpbb works, this should be easy. Just bypass cacheing when a cookie is detected with htaccess rules and for pages where phpbb doesn't set cookie, set a cookie so you can exclude with htaccess. See example of xenforo

Code: Select all

# 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>
Still, i am willing to pay if someone wishes to be paid for for their efforts.

Thanks.
Post Reply

Return to “Extension Requests”