LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > LiteSpeed Cache > Private cache max-age ?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2013, 02:08 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 114
Default Private cache max-age ?

Hello,

Your wiki says to use E=Cache-Control:max-age=60 for 60 seconds public cache and E=Cache-Control:private for private cache.

Both of these work with .htaccess and mod_rewrite rules

Can I set the max-age for private cache in htacess files ?

Or can users only use the server global defined private cache max-age value ?

Thanks
Reply With Quote
  #2  
Old 02-12-2013, 12:15 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,291
Quote:
Can I set the max-age for private cache in htacess files ?
yes. just tested and confirm it works.
Reply With Quote
  #3  
Old 02-12-2013, 12:25 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 114
Thanks,

How would I do this ? All my tries failed…
Reply With Quote
  #4  
Old 02-12-2013, 12:29 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,291
for example, in .htaccess,
Code:
RewriteRule \.php - [E=Cache-Control:private,E=Cache-Control:max-age=300]
or
Code:
RewriteRule \.php - [E=Cache-Control:private]
RewriteRule \.php - [E=Cache-Control:max-age=300]
Reply With Quote
  #5  
Old 02-12-2013, 01:03 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 114
Thanks,

I was under the impression that those lines would first set the envrionement variable to private and then replace the private setting by max-age=300 thus being the equivalent of only max-age=300…

With Apache's mod_cache, Cache-Control should be set to :

"max-age=300, private"
Reply With Quote
  #6  
Old 02-12-2013, 01:32 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 114
I've just tested :

RewriteRule \.php - [E=Cache-Controlrivate,E=Cache-Control:max-age=300]
Code:
X-LiteSpeed-Cache : hit

RewriteRule \.php - [E=Cache-Controlrivate]
Code:
X-LiteSpeed-Cache : hit,private
Reply With Quote
  #7  
Old 02-12-2013, 02:22 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,291
hmm ... I'd like to reproduce your result, to find out possible bugs.

what's the cache policy you set ? and any other rewrite rules ?

I did tests only for this simple php:
PHP Code:
/usr/local/lsws/DEFAULT/html>cat r.php
<?php
echo date("c");
echo 
"\n";
?>
Reply With Quote
  #8  
Old 02-12-2013, 02:42 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 114
Hello,

My .htaccess file :

Code:
RewriteEngine On

RewriteRule \.php - [E=Cache-Control:private,E=Cache-Control:max-age=300]
#end of file
I used your r.php script

Cache-Crontrol is an environement variable, if you set it twice it's normal that the second value replaces the first.

You need to be able to set both values seperated by a comma. However I havn't found the correct syntax to do this :

I've tried without success things like this :
Code:
RewriteRule \.php - [E=Cache-Control:'private, max-age=180']
But it gives an error in ls logs:
Code:
ERROR	[[HTAccess]] rewrite: Unknown rewrite rule flag while parsing: RewriteRule \.php - [E=Cache-Control:'private, max-age=180']
My cache is set to :

Code:
Enable Cache : Not Set
Cache Expire Time (seconds) : Not Set
Cache Request with Query String : Yes
Cache Request with Cookie : No
Cache Response with Cookie : No
Ignore Request Cache-Control : No
Ignore Response Cache-Contro : No
Enable Private Cache : Not Set
Private Cache Expire Time (seconds) : 60
Thanks
Reply With Quote
  #9  
Old 02-12-2013, 03:00 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,291
my test result always:
Code:
X-LiteSpeed-Cache: hit,private
here's one of result:
Code:
~>curl -i 127.0.0.1/r.php
HTTP/1.1 200 OK
Date: Tue, 12 Feb 2013 10:55:17 GMT
Server: LiteSpeed/4.2.2 Enterprise
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-LiteSpeed-Cache: hit,private
Content-Length: 26
X-Powered-By: PHP/5.3.10
Content-Type: text/html

2013-02-12T18:55:14+08:00
I'm testing with lsws 4.2.2
Reply With Quote
  #10  
Old 02-12-2013, 03:09 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 114
Quote:
~ curl -i http://test.tld/r.php
HTTP/1.1 200 OK
Date: Tue, 12 Feb 2013 11:03:35 GMT
Server: LiteSpeed
X-LiteSpeed-Cache: hit
Content-Length: 26
Content-Type: text/html; charset=UTF-8
Connection: close

2013-02-12T12:03:34+01:00
I haven't upgraded to LiteSpeed/4.2.2 Enterprise yet (I'm running 4.2.1).

Is 4.2.2 in Release ?

In my WHM interface it says :

Latest Release: 4.2.1

I prefer to wait untill version 4.2.2 shows as an available update in the WHM interface unless the update feature doesn't work and will never show the next version ?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:21 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.