Why Cloudflare adds Last-Modified header to html?

Why Cloudflare adds Last-Modified header to pages? It’s Cloudflare, in developer mode there isn’t this header added.
How can I disable/remove it?

Mainly because the item is cached and Cloudflare wants to tell you when was the latest version of the item starts caching.


Okay, I know the purpose of the Last-Modified header. The problem is that it’s nearly equivalent to a HTTP 304 Response in Google’s eyes.

How can I disable it?

Transform rules doesn’t work. Cloudflare puts Last-mod header on the first request from the origin (which is a MISS), then if I purge the page from the Cloudflare cache the Last-Mod header disappears.

Can you please provide us with your page/website?

I am very certain, that Cloudflare does not add it, since on none of my sites it is added when my webserver does not set it.

Are you referring to Cloudflare Pages, or to WebPages in general?

To trigger a 304 (not modified) response Cloudflare requires a Last-Modified header to check against. Otherwise it does not work.

Maybe related to https://blog.cloudflare.com/introducing-smart-edge-revalidation/

When both Last-Modified and Etag headers are absent from the origin server response, Smart Edge Revalidation will use the time the object was cached on Cloudflare’s edge as the Last-Modified header value. When a browser sends a revalidation request to Cloudflare using If-Modified-Since or If-None-Match , our edge can answer those revalidation questions using the Last-Modified header generated from Smart Edge Revalidation. In this way, our edge can ensure efficient revalidation even if the headers are not sent from the origin.

Smart Edge Revalidation will be enabled automatically for all Cloudflare customers over the coming weeks. If this behavior is undesired, you can always ensure that Smart Edge Revalidation is not activated by confirming your origin is sending ETag or Last-Modified headers when you want to indicate changed content. Additionally, you could have your origin direct your desired revalidation behavior by making sure it sets appropriate cache-control headers.

Smart Edge Revalidation is a win for everyone: visitors will get more content faster from cache, website owners can serve and revalidate additional content from Cloudflare efficiently, and the Internet will get a bit greener and more efficient.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.