litespeed public cache no plugin with ESI

#1
hi
i want to show current time in my cached pages

so i create ESI tag for display time in my html page
HTML:
<esi:include src="/time.php" />
in time.php file there a simple script that print time
PHP:
<?php
echo date("Y/m/d H:i:s");
?>
and in my .htaccess, i write the following codes
Code:
RewriteCond %{ORG_REQ_URI} !^/time.php
RewriteRule .* - [E=Cache-Control:max-age=120]
but in the response html page, time also cached by litespeed and it shows same time in each response not the fresh time!
 

mistwang

LiteSpeed Staff
#2
Your rewrite rule wont work as ESI happen at server side, the ORG_REQ_URI wont be /time.php
In your /time.php code, add header x-litespeed-cache-control: no-cache
 
Last edited by a moderator:
Top