Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Configure eTags?

Using ySlow, it recommends that I use eTags. I never heard of them before today. The question is now, how do I configure eTags?

I just spent the last 2 hours trying to figure this out. I tried adding various recommended scripts to my .htaccess file, but with no luck. ySlow keeps complaining...

My site is a secure site(https) on a litespeed web server. I seen some say you can't configure eTags on a litespeed web server. Is this true?

Thanks.

like image 308
Xarcell Avatar asked Nov 04 '12 01:11

Xarcell


People also ask

How do I set up entity tags?

Best practice to configure the entity tags for Multiple servers for website running on Apache is to remove the INode portion of the Etag. With this code, the INode would be removed from the Entity tags. Without the Server component, the Etags can perform its function properly.

How is ETag implemented?

To use ETag for optimistic concurrency, we need to use the If-Match header. While sending a request to change the state (e.g. PUT), we should send the expected state version as the value of the If-Match header. The server should check if the ETag value is equal to the current one. If it equals, save succeed.

How do I get my ETag response?

Etag Working Style in StepsRequestor request a resource from the server. The server generates an Etag value as a response header value. Requestor takes a 200 (Ok) status code for the resource and uses the Etag value for the If-None-Match request header. A requestor requests the same resource after a time.

Where are Etags stored?

The ETag is an identifier assigned to a data resource in a server, and if that resource is ever updated at the server, the ETag is changed. Whenever a resource is requested (via its URL), the data and ETag are retrieved and stored in the Web cache, and the ETag is sent along with subsequent requests.


2 Answers

Or, I don't know... Properly set them without the piece that makes them unique to a server.

FileETag MTime Size

I understand that it's easier to just tell people to not bother. But there is a lot of misinformation out there about ETags. They're not perfect, but can be handy when configured correctly.

like image 67
Vagari Avatar answered Nov 10 '22 00:11

Vagari


Note (2021-05-14) :

While historically there has been somewhat valid reasons to disable ETags - mainly pushed by Yahoo serving things from server farms and unable to implement ETags properly across all servers - ETags should not be disabled by default and chances are Yahoo's problems do not apply to you.


I think you're supposed to disable ETags, not turn them on.

Try this:

Header unset Pragma
Header unset ETag
FileETag None

References:

How to turn off Etag with htaccess?

http://davidwalsh.name/yslow-htaccess

like image 40
Adrian Macneil Avatar answered Nov 09 '22 22:11

Adrian Macneil