Mobile app version of vmapp.org
Login or Join
Carla537

: Last-modified/etags - to include or not? Google's PageSpeed plugin suggests that a website should include Last-Modified and ETag headers: Specify a cache validator "Resources that do not

@Carla537

Posted in: #Apache2 #PageSpeed

Google's PageSpeed plugin suggests that a website should include Last-Modified and ETag headers:


Specify a cache validator "Resources that do not specify a cache
validator cannot be refreshed efficiently. Specify a Last-Modified or
ETag header to enable cache validation"


However, Apache suggests that by not including them at all, we speed up websites by eliminating If-Modified-Since and If-None-Match requests:
www.askapache.com/htaccess/apache-speed-last-modified.html
these are in direct opposition - which should be implemented? I'm leaning towards Apache's suggestion, as when I want a file cached, I don't want it refreshed.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Carla537

1 Comments

Sorted by latest first Latest Oldest Best

 

@Rambettina238

The point is to get the browser to cache resources your site uses wherever possible, as this reduces either HTTP requests or data transferred, both of which help speed. You do this either by setting Expires headers, which tell the browser to cache the resource until the specified time; or by using Last Modified / Etags, which give the browser a way to work out if the resource it has previously cached needs to be updated.

The tips page you linked to (which is not an official Apache resource) states:


If you remove the Last-Modified and ETag header, you will totally eliminate If-Modified-Since and If-None-Match requests and their 304 Not Modified Responses, so a file will stay cached without checking for updates until the Expires header indicates new content is available!


the important point there being "...until the Expires header indicates...", so the advice given is valid if you are supplying an Expires header instead.

Expires headers give more of a speed improvement if you can use them, as when using Last Modified headers and Etags, even if all the resources are cached the browser still has to send the requests to the server, which takes time.

Google's speed recommendations have a pretty good write up.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme