Support » Plugin: Autoptimize » Headers

  • Resolved barthat


    I currently have multiple Cache-Control directives in my headers.

    HTTP/1.1 200 OK
        Server: cloudflare-nginx
        Date: Fri, 23 Aug 2013 14:00:13 GMT
        Content-Type: text/css; charset=utf-8
        Transfer-Encoding: chunked
        Connection: keep-alive
        Set-Cookie: __cfduid=d9875e4c85f50153f1327d57ba3dcc6181377266412900;
            expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/;
        Vary: Accept-Encoding,Cookie
        Cache-Control: max-age=30672000, public, must-revalidate
        Expires: Wed, 13 Aug 2014 14:00:12 GMT
        Last-Modified: Fri, 23 Aug 2013 10:18:55 GMT
        X-UA-Compatible: IE=edge
        Cache-Control: private, no-store, no-cache, must-revalidate, no-transform,
        CF-RAY: a2853e8a3cc3112
        Content-Encoding: gzip

    and REDbot is throwing up errors / warnings on the autoptize generated php files….

    The ETag header’s syntax isn’t valid.
    The max-age Cache-Control directive appears more than once.

    Note: I am also using WP-Supercache, I have cache-control and expiry directives in my htaccess, and I am using Cloudflare.

    What headers does Autoptimze add and do you have any advice on changes I should make?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frank Goossens


    the versions pre-1.6.0 had an max-age that was too long. the current code does this (cfr.;

    $expireTime=60*60*24*355; // 1y max according to RFC
    header('Cache-Control: max-age='.$expireTime.', public, must-revalidate');
    header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expireTime).' GMT');
    header('Last-Modified: '.gmdate('D, d M Y H:i:s', $modTime).' GMT');

    hope this helps,

    Yes, That was helpful thanks.

    I still don’t understand why I get “The ETag header’s syntax isn’t valid.” for this header Last-Modified: Fri, 23 Aug 2013 10:18:55 GMT.

    I fixed my other headers issues with this

    <FilesMatch "^autoptimize_.*\.php$">
    	Header unset Cache-Control
    	Header merge Cache-Control "proxy-revalidate"
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Headers’ is closed to new replies.