How to enable ETag in Apache Http Server

If your using Apache HTTP Server then you can use it to generate and return ETag for static resources that are served from disk. The Apache Http Server also takes care of comparing the value of If-None-Match header with ETag of the resource and returning either 304 Not modified or 200 OK.

Support for ETag is part of the Apache Core and it is enabled by default. Ex. These are the response headers that i get when i try to access cachesample.gif, which is a static image file on disk from Apache Server

The value of ETag header in this case is combination of three things INode MTime Size

You can configure the behavior of the ETag using the FileETag directive which configures the file attributes that are used to create the ETag (entity tag) response header field when the document is based on a file. (The ETag value is used in cache management to save network bandwidth.) In Apache 1.3.22 and earlier, the ETag value was always formed from the file's inode, size, and last-modified time (mtime). The FileETag directive allows you to choose which of these -- if any -- should be used. The recognized keywords are:

  1. INode : The file's i-node number will be included in the calculation. i-node is the number generated by OS to keep track of the file, it includes things like access level, creation time,... You can configure apache to use only INode by adding this line to httpd.conf

    FileETag INode

    This is screen of how the INode only ETag looks like

  2. MTime: The date and time the file was last modified will be included. You can configure apache to use only Last-Modified date of the file to generate ETag by adding this line to httpd.conf

    FileETag MTime

    This is how my cachecontrol.gif response headers look like when i use MTime for ETag generation

  3. Size: The number of bytes in the file will be included. You can configure Apache to use only size of the file for generating ETag by adding this line to httpd.conf

    FileETag Size

    This screen shot of headers when Apache is configured to use only file Size for calculating ETag

  4. All: All available fields will be used. This is equivalent to: FileETag INode MTime Size

  5. None: You can disable generation of ETag by Apache Http Server by adding this line

    FileETag None

    THis is screen shot of headers after ETag is disabled


Unknown said...

Thanks for your post and welcome to check: here

Anonymous said...

Hi , The httpd.conf in my case is empty (Apache/2.2.22 ) . Where can I find this configuration ?

ajit patel said...

Impressive! I really like your blog. Thanks for the post.
seo company in nagpur
website services in nagpur


Nice blog..! I really loved reading through this article. Thanks for sharing such
a amazing post with us and keep blogging...
digital marketing services in khammam
seo services in khammam
smm services in khammam

Android Mobile App Development said...

Thanks for sharing this information I really enjoyed reading this article
if you are looking for Android Mobile App Development
,IOS application development from the unplugged web please visit us.

Seo Chicago said...

Thank you for sharing the information with essential fact,FOR
Web Design Chicago and Content Writing Chicago. visit us

srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

BatteryMantra No. 1online battery store said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

Genxsoft said... is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery

Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store

katetech said...

Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
digital marketing services in kothagudem
seo services in kothagudem

katetech said...

Useful Information, your blog is sharing unique information....
Thanks for sharing!!!
php developers in kphb
php developers in ameerpet
php development companies in hyderabad

Transport company in Taif said...

أفضل شركة نقل في الطائف والنجارين في إعمار في تفكيك وتركيب الأثاث

Mr Solution said...

How To Make Money From Youtube
Web Development
How To Approve Google Adsense Account
Seo Marketing
How To Make Free Website
Ecommerce Education
Mobile Software Course English/Urdu/Hindi

Anonymous said...

lampung Info

Abhi said...

Thanks for info
Web Design Company in Bangalore
Website development in Bangalore

Abhi said...

Thanks for info
Customized Erp Solutions