• Resolved steven.m

    (@stevenmaas)


    For some reason my html cache control header shows public twice. In the cache directory the html .htaccess file shows the below:

    BEGIN W3TC Page Cache cache

    Header append Cache-Control “public”

    I have the html in W3TC set to cache with max age (public, max age).

    Is W3TC appending public to the cache header a second time?

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stevenmaas

    Thank you for reaching out and I am happy to help!
    Can you please check the .htaccess in the root of the website, and check if there are any duplicate rules for the cache control, so any rules besides the W3 Total Cache, also, please let me know if you are using any other plugins for the optimization or any custom rules or some CDN.
    It would be great if you could share the website URL so I can check this

    Thank you!

    Thread Starter steven.m

    (@stevenmaas)

    No CDN. I disabled the W3TC plugin and no expires header was added to html. I checked the page enhanced and parent folders I see no additional html header expires info. On the server I do not see any Additional Apache or Nginx directives for html.

    All my websites with W3TC on html show public, public

    Page enhanced .htaccess…

    # BEGIN W3TC Page Cache cache
    AddDefaultCharset UTF-8
    FileETag MTime Size
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M86400
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>
    # END W3TC Page Cache cache
    • This reply was modified 1 year, 4 months ago by steven.m.
    Thread Starter steven.m

    (@stevenmaas)

    I did find this in .htaccess root.

    # BEGIN W3TC Browser Cache
    <IfModule mod_mime.c>
    AddType text/css .css
    AddType text/x-component .htc
    AddType application/x-javascript .js
    AddType application/javascript .js2
    AddType text/javascript .js3
    AddType text/x-js .js4
    AddType text/html .html .htm
    AddType text/richtext .rtf .rtx
    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/avif .avif
    AddType image/avif-sequence .avifs
    AddType image/bmp .bmp
    AddType application/java .class
    AddType video/divx .divx
    AddType application/msword .doc .docx
    AddType application/vnd.ms-fontobject .eot
    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 image/webp .webp
    AddType application/json .json
    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 video/webm .webm
    AddType application/vnd.ms-project .mpp
    AddType application/x-font-otf .otf
    AddType application/vnd.ms-opentype ._otf
    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 video/ogg .ogv
    AddType application/pdf .pdf
    AddType image/png .png
    AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
    AddType audio/x-realaudio .ra .ram
    AddType image/svg+xml .svg .svgz
    AddType application/x-shockwave-flash .swf
    AddType application/x-tar .tar
    AddType image/tiff .tif .tiff
    AddType application/x-font-ttf .ttf .ttc
    AddType application/vnd.ms-opentype ._ttf
    AddType audio/wav .wav
    AddType audio/wma .wma
    AddType application/vnd.ms-write .wri
    AddType application/font-woff .woff
    AddType application/font-woff2 .woff2
    AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
    AddType application/zip .zip
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css A31536000
    ExpiresByType text/x-component A31536000
    ExpiresByType application/x-javascript A31536000
    ExpiresByType application/javascript A31536000
    ExpiresByType text/javascript A31536000
    ExpiresByType text/x-js A31536000
    ExpiresByType text/html A86400
    ExpiresByType text/richtext A86400
    ExpiresByType text/plain A86400
    ExpiresByType text/xsd A86400
    ExpiresByType text/xsl A86400
    ExpiresByType text/xml A86400
    ExpiresByType video/asf A31536000
    ExpiresByType video/avi A31536000
    ExpiresByType image/avif A31536000
    ExpiresByType image/avif-sequence A31536000
    ExpiresByType image/bmp A31536000
    ExpiresByType application/java A31536000
    ExpiresByType video/divx A31536000
    ExpiresByType application/msword A31536000
    ExpiresByType application/vnd.ms-fontobject A31536000
    ExpiresByType application/x-msdownload A31536000
    ExpiresByType image/gif A31536000
    ExpiresByType application/x-gzip A31536000
    ExpiresByType image/x-icon A31536000
    ExpiresByType image/jpeg A31536000
    ExpiresByType image/webp A31536000
    ExpiresByType application/json A31536000
    ExpiresByType application/vnd.ms-access A31536000
    ExpiresByType audio/midi A31536000
    ExpiresByType video/quicktime A31536000
    ExpiresByType audio/mpeg A31536000
    ExpiresByType video/mp4 A31536000
    ExpiresByType video/mpeg A31536000
    ExpiresByType video/webm A31536000
    ExpiresByType application/vnd.ms-project A31536000
    ExpiresByType application/x-font-otf A31536000
    ExpiresByType application/vnd.ms-opentype A31536000
    ExpiresByType application/vnd.oasis.opendocument.database A31536000
    ExpiresByType application/vnd.oasis.opendocument.chart A31536000
    ExpiresByType application/vnd.oasis.opendocument.formula A31536000
    ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
    ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
    ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
    ExpiresByType application/vnd.oasis.opendocument.text A31536000
    ExpiresByType audio/ogg A31536000
    ExpiresByType video/ogg A31536000
    ExpiresByType application/pdf A31536000
    ExpiresByType image/png A31536000
    ExpiresByType application/vnd.ms-powerpoint A31536000
    ExpiresByType audio/x-realaudio A31536000
    ExpiresByType image/svg+xml A31536000
    ExpiresByType application/x-shockwave-flash A31536000
    ExpiresByType application/x-tar A31536000
    ExpiresByType image/tiff A31536000
    ExpiresByType application/x-font-ttf A31536000
    ExpiresByType application/vnd.ms-opentype A31536000
    ExpiresByType audio/wav A31536000
    ExpiresByType audio/wma A31536000
    ExpiresByType application/vnd.ms-write A31536000
    ExpiresByType application/font-woff A31536000
    ExpiresByType application/font-woff2 A31536000
    ExpiresByType application/vnd.ms-excel A31536000
    ExpiresByType application/zip A31536000
    </IfModule>
    <FilesMatch "\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
    Header set Pragma "public"
    Header append Cache-Control "public"
    Header unset Set-Cookie
    </IfModule>
    </FilesMatch>
    <FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|TXT|XSD|XSL|XML)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>
    </FilesMatch>
    <FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|avif|avifs|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|webm|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|AVIF|AVIFS|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|WEBP|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|WEBM|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|OGV|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|_TTF|WAV|WMA|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>
    </FilesMatch>
    # END W3TC Browser Cache

    Notice the below…

    <FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|TXT|XSD|XSL|XML)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>
    </FilesMatch>

    So is the root .htaccess appending and page enhanced .htaccess appending public to header?

    • This reply was modified 1 year, 4 months ago by steven.m.
    • This reply was modified 1 year, 4 months ago by steven.m.
    Thread Starter steven.m

    (@stevenmaas)

    I was able to confirm it is WT3C. I hashed out one at a time both Header append Cache-Control “public” in root and page enhanced .htaccess and verified no public in the html when I recached the page.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stevenmaas

    Thank you for yoru feedback.
    I cannot seem to replciate this at all:

    Just to confirm, does the problem persit if you disable Page Cache? Alo have you tried clearing the browser cache?

    Thanks!

    Thread Starter steven.m

    (@stevenmaas)

    I cleared the cache. I also disabled w3tc and both public entries disappear. Did you set etag? Are you seeing the below in the page enhanced .htaccess?

    # BEGIN W3TC Page Cache cache
    AddDefaultCharset UTF-8
    FileETag MTime Size
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M86400
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>
    # END W3TC Page Cache cache

    I am able # out either root or page enhanced Header append Cache-Control “public” and they disappear in the browser header.

    • This reply was modified 1 year, 4 months ago by steven.m.
    Thread Starter steven.m

    (@stevenmaas)

    Etag is not the issue. In General you have the option to set expires header.

    In html xml you have the option to “set Set cache control header”.

    This setting when enabled ads the public header in the page_enhanced .htaccess.

    # BEGIN W3TC Page Cache cache
    AddDefaultCharset UTF-8
    FileETag MTime Size
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M86400
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>
    # END W3TC Page Cache cache

    When html xml “set Set cache control header” is unchecked the below is removed

    Header set Pragma "public"
    Header append Cache-Control "public"
    # BEGIN W3TC Page Cache cache
    AddDefaultCharset UTF-8
    FileETag MTime Size
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M86400
    </IfModule>
    <IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
    </IfModule>
    # END W3TC Page Cache cache

    In general you have the option Set expires header. If checked should I not set it in the html xml?

    • This reply was modified 1 year, 4 months ago by steven.m.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stevenmaas

    These are the settings I have for the Browser Cache – HTML section

    Is there any chance you could share the website URL? Yes, the .htaccess in the cache folder contain those rules. I was just wondering if disabling the page Cache entirely helps in this case.

    Thanks!

    Thread Starter steven.m

    (@stevenmaas)

    I can perfectly replicate the issue in W3TC. It adds the same code in root and page_enhanced .htaccess when General and HTML & XML (x) Set cache control header are checked.

    <IfModule mod_headers.c>
    Header set Vary "Accept-Encoding, Cookie"
    Header set Pragma "public"
    Header append Cache-Control "public"
    </IfModule>

    Since there is two entries, two public entries are appended and shown in the browser. I can # in the .htaccess in either location of both to remove both public entries.

    If I uncheck both General and HTML & XML (x) Set cache control header the above code is removed in both places. I can verify on the sever without looking at the actual cached webpage. If I look at the cached webpage it matches what is in the .htaccess.

    I noticed that if I click General (x) Set cache control and save it, it automatically checks the HTML & XML (x) Set cache control header on save.

    If you are using page enhanced and set both General and HTML & XML (x) Set cache control header are checked you should see the same two .htaccess entries in root and the other in page_enhanced correct? If you are not seeing 2 entires in .htaccess and I am then the must be some other setting in W3TC on my side causing this?

    • This reply was modified 1 year, 4 months ago by steven.m.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stevenmaas

    Thank you for your feedback.
    I do have a Page Caching set with Disk: Enhaced and yes, there is a .htaccess file in the folder due to how the Disk: Enhanced caching method works, meaning using rewrite capabilities of your server.
    This being said, while I understand your point, I am failing to see if you tested the behavior with Page Cache disabled.
    So all the settings in the Browser cache remain untact, disable the Page Cache, save all settings and purge the cache and let me know if in this case two public entries appear

    Thanks!

    Thread Starter steven.m

    (@stevenmaas)

    I have deactivated your plugin and both public entries disappear.

    If I uncheck Browser Cache > General ( ) Set cache control header and save, W3TC automatically unchecks HTML & XML ( ) Set cache control header. With both NOT selected both .htaccess files do not have Header append Cache-Control “public”. When I purge and preload browser shows no public at all in the browser only max-age.

    I have already performed this as mentioned above. In addition to # hashing out the Header append Cache-Control “public” in both .htaccess files

    You mentioned you set page enhanced above and have an .htaccess file in page_enhanced. DO YOU SEE see the Header append Cache-Control “public” ?????

    W3TC for HTML sets Header append Cache-Control “public” in root and Header append Cache-Control “public” in page_enhanced therefore your going to see 2 PUBLIC entries in the browser!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @stevenmaas

    Thank you for your feedback.
    I am not sure if I am asking the qeustion correctly. To answer yours, yes I do see Cache-Control “public” in both .htaccess files, however, as you can see in the screenshot, only one public is added.
    Can you please not hash out anything, and please go to Performance>General settings, uncheck the Page Cache, save all settings, and purge the cache and please let me know if with disabled Page Caching, the second public appears inthe cache control header for the HTML

    Thanks!

    Thread Starter steven.m

    (@stevenmaas)

    I unchecked General > Page Cache: ( )Enable. Now browser only shows max-age with no public.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hey @stevenmaas

    Thank you for your feedback.
    Just to confirm, once I disabled Page Cache the header is: cache-control: max-age=3600, public

    In your case, are both public removed or only one?

    Thanks!

    Thread Starter steven.m

    (@stevenmaas)

    Yes. Both Public are removed from the browser when disabled. Also, if I enable General > Page Cache: (x )Enable and select redis only one public will show in browser.

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Cache Comtrol header shows Public twice’ is closed to new replies.