The Last-Modified header is an HTTP response header that indicates the date and time when the server believes the resource was last changed. It is commonly used for browser caching and conditional requests, helping reduce bandwidth and improve site performance.

Direct Example

When a client requests a page, the server may respond with:

HTTP/1.1 200 OK
Date: Mon, 19 Aug 2024 14:12:00 GMT
Server: LiteSpeed
Content-Type: text/html; charset=UTF-8
Last-Modified: Sun, 18 Aug 2024 16:45:00 GMT

Here:

  • Last-Modified: Sun, 18 Aug 2024 16:45:00 GMT tells the browser the file was last updated at that time.

  • On the next request, the browser can send If-Modified-Since: Sun, 18 Aug 2024 16:45:00 GMT.

  • If the file hasn’t changed, the server replies with 304 Not Modified, saving bandwidth.

Why It Matters

  • Improves loading speed for repeat visitors.

  • Reduces unnecessary data transfer.

  • Plays a key role in SEO performance by signaling freshness of content.

Conclusion

The Last-Modified header is a simple but powerful caching mechanism. By sending it correctly, servers help browsers and search engines understand when a resource has changed, leading to faster websites and lower server load.