[Plugin: W3 Total Cache] Header Expire
-
I have a question when using the Expires Header option within w3-total-cache Browser Cache.. When I check my site using redbot.org, it shows:
#Vary: User-Agent can cause cache inefficiency
# This response is stale.
# This response might be served by a cache, even though it is stale.Is this a normal behavior that I should ignore ?
Thanks
-
This might be caused if your server doesn’t have the time correctly set, or doesn’t provide the timezone to PHP, maybe.
I’m on shared hosting and get a warning about PHP timezone from W3TC’s compatibility check, and got a similar error (I can’t remember exactly what it said now) when I used redbot to check the headers. I haven’t got round to asking my hosting company if they can do something about it yet, so it could be something else entirely!
Still no go.
Server Modules & Resources:
PHP Version: 5.1.6
PHP Timezone: OK
Web Server: Apache
FTP functions: OK (required for Self-hosted (FTP) CDN support)
Multibyte String support: OK (required for Rackspace Cloud Files support)
cURL extension: OK (required for Amazon S3 support)
zlib extension: OK (required for compression support)
Opcode cache: eAccelerator
Memcache extension: OK
Mime type detection: Mimetype
Hash function: hash (required for NetDNA purge support)
Safe mode: Off
Open basedir: Off
zlib output compression: Off
mod_mime: OK
mod_expires: OK
mod_deflate / mod_gzip: OK
mod_headers: OK
mod_env: OK
mod_setenvif: OK
mod_rewrite: OKHow did you get all your mods turned on and eAccelerator enabled, I new to VPS, and all mine come back not installed when i do compatibility check, any help is appreciated.
@invi2003, requires mod_expires and the appropriate browser cache options enabled for the object you’re testing. Make sure that .htaccess is updated (there are no warnings from W3TC) and from there you should be ok.
@thatruth2006, hard question to answer without knowing how your server is set up.
@thatruth2006 I have my own dedicated server so I was able to enable these features. Don’t know much about doing it on VPS.
@frederick Townes here’s my .htaccess code
# BEGIN W3TC Skip 404 error handling by WordPress for static files
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} \.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
RewriteRule .* – [L]
</IfModule>
# END W3TC Skip 404 error handling by WordPress for static files# BEGIN HTTP Compression
<IfModule mod_deflate.c>
# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don’t compress media or scripts
SetEnvIfNoCase Request_URI (?:bmp|gif|jpe?g|php|png|swf|tiff?)$ no-gzip dont-vary
# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
# Fragment size to be compressed at one time by zlib
#DeflateBufferSize 4096
# Amount of compression applied to output
#DeflateCompressionLevel 9
# How much memory should be used by zlib for compression
#DeflateMemLevel 9
# Zlib compression window size
#DeflateWindowSize 15
# Enable HTTP Compression policy for all except .css, .js and .html documents
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/css text/plain text/html text/xml text/xsd text/xsl application/x-javascript \
\. application/wlwmanifest+xml image/svg+xml image/x-icon
</IfModule>
# END HTTP Compression# BEGIN W3TC Browser Cache
<IfModule mod_mime.c>
AddType text/css .css
AddType application/x-javascript .js
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
AddType text/xsd .xsd
AddType text/xsl .xsl
AddType text/xml .xml
AddType video/asf .asf .asx .wax .wmv .wmx
AddType video/avi .avi
AddType image/bmp .bmp
AddType application/java .class
AddType video/divx .divx
AddType application/msword .doc .docx
AddType application/x-msdownload .exe
AddType image/gif .gif
AddType application/x-gzip .gz .gzip
AddType image/x-icon .ico
AddType image/jpeg .jpg .jpeg .jpe
AddType application/vnd.ms-access .mdb
AddType audio/midi .mid .midi
AddType video/quicktime .mov .qt
AddType audio/mpeg .mp3 .m4a
AddType video/mp4 .mp4 .m4v
AddType video/mpeg .mpeg .mpg .mpe
AddType application/vnd.ms-project .mpp
AddType application/vnd.oasis.opendocument.database .odb
AddType application/vnd.oasis.opendocument.chart .odc
AddType application/vnd.oasis.opendocument.formula .odf
AddType application/vnd.oasis.opendocument.graphics .odg
AddType application/vnd.oasis.opendocument.presentation .odp
AddType application/vnd.oasis.opendocument.spreadsheet .ods
AddType application/vnd.oasis.opendocument.text .odt
AddType audio/ogg .ogg
AddType application/pdf .pdf
AddType image/png .png
AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
AddType audio/x-realaudio .ra .ram
AddType application/x-shockwave-flash .swf
AddType application/x-tar .tar
AddType image/tiff .tif .tiff
AddType audio/wav .wav
AddType audio/wma .wma
AddType application/vnd.ms-write .wri
AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
AddType application/zip .zip
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css M3600
ExpiresByType application/x-javascript M3600
ExpiresByType text/html M3600
ExpiresByType text/richtext M3600
ExpiresByType image/svg+xml M3600
ExpiresByType text/plain M3600
ExpiresByType text/xsd M3600
ExpiresByType text/xsl M3600
ExpiresByType text/xml M3600
ExpiresByType video/asf M31536000
ExpiresByType video/avi M31536000
ExpiresByType image/bmp M31536000
ExpiresByType application/java M31536000
ExpiresByType image/x-icon M31536000
ExpiresByType image/jpeg M31536000
ExpiresByType application/vnd.ms-access M31536000
ExpiresByType audio/midi M31536000
ExpiresByType video/quicktime M31536000
ExpiresByType audio/mpeg M31536000
ExpiresByType video/mp4 M31536000
ExpiresByType video/mpeg M31536000
ExpiresByType application/vnd.ms-project M31536000
ExpiresByType application/vnd.oasis.opendocument.database M31536000
ExpiresByType application/vnd.oasis.opendocument.chart M31536000
ExpiresByType application/vnd.oasis.opendocument.formula M31536000
ExpiresByType application/vnd.oasis.opendocument.graphics M31536000
ExpiresByType application/vnd.oasis.opendocument.presentation M31536000
ExpiresByType application/vnd.oasis.opendocument.spreadsheet M31536000
ExpiresByType application/vnd.oasis.opendocument.text M31536000
ExpiresByType audio/ogg M31536000
ExpiresByType application/pdf M31536000
ExpiresByType image/png M31536000
ExpiresByType application/vnd.ms-powerpoint M31536000
ExpiresByType audio/x-realaudio M31536000
ExpiresByType application/x-shockwave-flash M31536000
ExpiresByType application/x-tar M31536000
ExpiresByType image/tiff M31536000
ExpiresByType audio/wav M31536000
ExpiresByType audio/wma M31536000
ExpiresByType application/vnd.ms-write M31536000
ExpiresByType application/vnd.ms-excel M31536000
ExpiresByType application/zip M31536000
</IfModule>
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
<FilesMatch “\.(css|js)$”>
<IfModule mod_headers.c>
Header set Pragma “public”
Header set Cache-Control “public”
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By “W3 Total Cache/0.9.1.1”
</IfModule>
</FilesMatch>
<FilesMatch “\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$”>
<IfModule mod_headers.c>
Header set Pragma “public”
Header set Cache-Control “public, must-revalidate, proxy-revalidate”
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By “W3 Total Cache/0.9.1.1”
</IfModule>
</FilesMatch>
<FilesMatch “\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$”>
<IfModule mod_headers.c>
Header set Pragma “public”
Header set Cache-Control “public, must-revalidate, proxy-revalidate”
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By “W3 Total Cache/0.9.1.1”
</IfModule>
</FilesMatch>
<FilesMatch “\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$”>
<IfModule mod_headers.c>
Header set Pragma “public”
Header set Cache-Control “public, must-revalidate, proxy-revalidate”
</IfModule>
FileETag MTime Size
<IfModule mod_headers.c>
Header set X-Powered-By “W3 Total Cache/0.9.1.1”
</IfModule>
</FilesMatch>
# END W3TC Browser Cache# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule># END WordPress
Ok, so did you use one the various tools mentioned in the FAQ to test your pages/objects? https://web-sniffer.net/ is a decent tool.
I tried the tool and this is the result i see when using googbot as the agent
HTTP Response Header
Name Value Delim
Status: HTTP/1.1 200 OK
Date: Wed, 04 Aug 2010 16:57:28 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: W3 Total Cache/0.9.1.1
X-Pingback: https://www.(REMOVED).com/xmlrpc.php
Cache-Control: max-age=-440870
Expires: Fri, 30 Jul 2010 14:29:38 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Content-Length: 17518
Connection: close
Content-Type: text/html; charset=UTF-8But when I do it with Web-sniffer as an agent it shows
HTTP Response Header
Name Value Delim
Status: HTTP/1.1 200 OK
Date: Wed, 04 Aug 2010 16:59:55 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
Last-Modified: Wed, 04 Aug 2010 16:37:46 GMT
Vary: Accept-Encoding,Cookie,User-Agent
Expires: Wed, 04 Aug 2010 17:37:46 GMT
Pragma: public
Cache-Control: public, must-revalidate, proxy-revalidate
Etag: 1413eb9051a3c4b55ed9eaccdd79cf97
Content-Encoding: gzip
X-Pingback: https://www.(REMOVED).com/xmlrpc.php
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8I’m kind of confuse here. Checking Google and Yahoo the last cache page they have of my site is Google from 6/28/2010 and Yahoo 8/01/2010
You have some non-default settings or other (non-W3TC) directives in your .htaccess file that are causing anomalies.
Can you submit a bug submission form from the support tab of the plugin?
Just did.
Just so you know I just added this to .htaccess while troubleshooting
<FilesMatch “\.(html|htm|xml|txt|xsl|rdf|rss|gz|gzip)$”>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A3600
</IfModule>
</FilesMatch># 1 Year
<FilesMatch “\.(gif|ico|jpg|jpeg|jpe|png)$”>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A2592000
</IfModule>
</FilesMatch>Replied.
Frederick Thanks for the support. For now I’ll leave header cache disabled via the plugin and im adding the header expire manually to .htaccess. I’m already seeing improvement.
Thanks.
Ok, but that doesn’t help improve the plugin which intends to do this automatically for you.
- The topic ‘[Plugin: W3 Total Cache] Header Expire’ is closed to new replies.