Etag could not be disabled

In Browser Cache TTL setting, I selected “Respect Existing Setting”. What I understand is to adopt caching rules sent from my original server. It looks not always the case.

I tested in Chrome browser. From Inspect-> Network, I could find response headers. For js, woff2, css files, the header contains both etag and last-modified values. I’d like disable etag as it’s redundant. I added the following code in .htaccess file in order to disable etag directive. But it looks nothing changed in the header.

My question is,
Can I overwrite the settings of cf on browser caching? Anything I missed if yes?

Regards
Steven

  1. Take backup of server
  2. Enable headers module & restart Apache2 server
sudo  a2enmod headers
sudo service apache2 restart
  1. Take backup of .htaccess
  2. Then attempt to use below rule in first line of .htaccess for immediate effect
Header unset ETag
FileETag None
  1. If everything okay, you should’t receive Error 500. Try adding query string in resources path to check quickly.
  2. Purge cache at Cloudflare

I hope this helps.

Thanks, GulshanKumar

Problem solved. I didn’t purge cache at Cloudflare. Now my setting is reflected on browser end.

Well sure but… used differently. Is there some performance benefit to this change or just a lot of free time?

Yes.
Etag is to tell browser if there’s any edit or update on the resources. Last-modified does similarly to tell if the last modified time is changed. If not, browser will use local cached resources given browser cache directive is seen on the header. If any of the two is changed, the browser is to fetch from the server.

Remove one of them could reduce one trip of communication between client and server. See google image below. Google only uses last-modified for images. Check out the performance of the image heavy website. Of course, it’s the result of various of techniques, incl. polish, mirage, rocket loader, etc.

That shouldn’t be the case. If it is, something else is wrong. It’s normal (and expected) for Last-Modified/If-Modified-Since and ETag/If-None-Match to be used in conjunction. They have different advantages and disadvantages.

Thanks, @Zenexer for your pointing out. You are correct. It should happen by one trip.

This article recommends no Etag, no Last-Modified settings for js,css, and image files, which looks more aggressive.

It appears to recommend the opposite–use ETag and Last-Modified.

What you don’t often see in these guides is that you can combine those features with HTTP/2 server push (alternatively, WordPress-specific instructions) to significantly reduce the number of round trips. If you’re concerned about load times for static resources, reducing round trips, and reducing bandwidth, HTTP/2 server push is the way to go.

This topic was automatically closed after 30 days. New replies are no longer allowed.