Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38747
    Eric Brown
    Guest

    I noticed that cache-control headers are not set for dynamic content. For example, if I go to the “about-us” page of our test site, I get the following headers:

    HTTP/2 200
    content-type: text/html; charset=UTF-8
    server: nginx
    date: Wed, 31 Mar 2021 22:51:29 GMT
    x-powered-by: W3 Total Cache/2.1.1

    I have Browser Cache enabled. Under “General,” I have the following options enabled: Set Last-Modified header, Set expires header, Set cache control header, Set entity tag (ETag), Set W3 Total Cache header. (I have additional options selected for CSS, JS, HTML, etc — these all seem to work fine).

    Does W3TC support setting cache-control headers for dynamic content?

    #38766
    Marko Vasiljevic
    Keymaster

    Hello Eric,

    Thank you for reaching out.
    It would be great if you could share the website URL so I can check this.
    Also, can you please define the Dynamic Content?
    Do you have any other BC rules defined in the nginx.conf or on the server besides W3TC rules?
    Thanks!

    #38769
    Eric Brown
    Guest

    Thanks for your reply! Unfortunately, I cannot share the website URL since the site is under development and only available behind a firewall (access is restricted by our security policy at this point).

    By “Dynamic Content,” I mean any page or post that can be edited in the wp-admin (for example, a “contact-us” page or “about-us” page). I double-checked and there are no other cache-control related rules on the server.

    The plugin clearly sets cache-control headers for static content, like js, css, and html.

    For example, if I curl an image, the server returns last-modified, cache-control, expires and eTag as expected.

    
    curl -I https://[redacted]/wp-content/uploads/2019/08/Citizenship.png
    HTTP/2 200
    content-type: image/png
    content-length: 257499
    server: nginx
    date: Wed, 02 Jun 2021 16:18:16 GMT
    last-modified: Tue, 13 Aug 2019 23:00:24 GMT
    accept-ranges: bytes
    cache-control: max-age=31536000, public
    expires: Thu, 02 Jun 2022 16:18:16 GMT
    referrer-policy: no-referrer-when-downgrade
    pragma: public
    x-powered-by: W3 Total Cache/2.1.3
    x-powered-by: PleskLin
    etag: "3eddb-590079b0c5200"
    

    However, if I try to curl a dynamic page, there are no cache-related headers (last-modified, etag, etc). This appears to be by design.

    
    curl -I https://[redacted]/about-us/
    HTTP/2 200
    content-type: text/html; charset=UTF-8
    server: nginx
    date: Wed, 02 Jun 2021 16:20:04 GMT
    vary: Accept-Encoding
    x-powered-by: W3 Total Cache/2.1.3
    link: <https://[redacted]/wp-json/>; rel="https://api.w.org/", <https://[redacted]/wp-json/wp/v2/pages/9>; rel="alternate"; type="application/json", <https://[redacted]/?p=9>; rel=shortlink
    vary: User-Agent
    referrer-policy: no-referrer-when-downgrade
    x-powered-by: PleskLin
    
    #38797
    Marko Vasiljevic
    Keymaster

    Hello Eric,
    Well, this is really strange.
    So the cache control applies to the files but not to the HTML/XMl?
    Can you please share more information about your environment?
    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Cache-Control headers for dynamic content’ is closed to new replies.