Tagged: Cache Control Headers
-
AuthorPosts
-
June 2, 2021 at 11:55 am #38747Eric BrownGuest
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.1I 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?
June 2, 2021 at 12:01 pm #38766Marko VasiljevicKeymasterHello 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!June 3, 2021 at 10:31 am #38769Eric BrownGuestThanks 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
June 3, 2021 at 11:01 am #38797Marko VasiljevicKeymasterHello 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! -
AuthorPosts
- The topic ‘Cache-Control headers for dynamic content’ is closed to new replies.