Cache hits on Firefox but Not hitting on Chrome for Laravel Application

#1
I have plesk+litespeed+lscache for laravel. My cache hits on Firefox but not on google chrome. What could be the reason? Here is my config files:
the route group is like below
Code:
Route::group(['prefix' => 'members', 'middleware' => ['auth','license','lscache:private;esi=on;max-age=120']], function () {
    Route::get('/', ['middleware' => ['manage-members|view-member'], 'uses' => 'MembersController@index']);
});
Env is like below
Code:
LSCACHE_DEFAULT_TTL=0
LSCACHE_DEFAULT_CACHEABILITY=private
;
and finally the .htaccess is like below
Code:
<IfModule Litespeed>
CacheLookup on
CacheEngine on esi crawler
   RewriteEngine On
    RewriteRule .* - [E=Cache-Vary:Authorization]
</IfModule>


<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    # Redirect Trailing Slashes If Not A Folder...

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
 
   RewriteEngine On

</IfModule>

;
 
Last edited:
#3
LScache is URL based and not browser based, so there must be any other reason that causes this issue.

This must be set in LiteSpeed WebAdmin console and cannot defined in .htaccess
Code:
CacheEngine on esi crawler
You have defined private cache, but no configuration for public cache.
https://docs.litespeedtech.com/lscache/lsclaravel/settings/
Thanks for your reply. But It is an authenticated platform so Public cache makes it for all users where my users has their own pages so cache must be user based not public.

As you suggested I have added the directives in webadmin console but I still have the same problem. But one thing to note that; If I enable caching as public, chrome hits the cache, too.

What should I do to keep cache for each user and hit on requests?
 
#5
.htaccess is below

Code:
<IfModule Litespeed>
CacheLookup on
    RewriteEngine On
   # Redirect Trailing Slashes If Not A Folder...
    RewriteRule .* - [E=Cache-Vary:Authorization]

</IfModule>

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>
I will am sending you the phpinfo via private message since it has sensitive information.
 
#6
Code:
CacheLookup on
    RewriteEngine On
   # Redirect Trailing Slashes If Not A Folder...
    RewriteRule .* - [E=Cache-Vary:Authorization]
</IfModule>
Authorization for cache vary doesn't work that way. You should study LScache documentation how LScache works and how to use Cache-Vary. If a Cache-Vary is defined an extra cache copy is created and doesn't limit what is cached or not cached. Basically a page cache is like car without brakes and steering wheel, but with full throttle, if there is no cache rule defined, meaning every requested ( and dynamic) source is cached, so you must either set rewrite rule or/and a PHP header to control the cache.

https://docs.litespeedtech.com/lscache/
 
Top