[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ETag & Content-Encoding




Hi all,

I have a question about the Entity Tag (ETag) and the Content-Encoding.

Should ETag be different when the content is transferred with different Content-Encoding?

For example, here are the HTTP Response Headers when there is no Content-Encoding:

HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.4
ETag: "8c9329975a5e17e029312bcda6228450"
Cache-Control: max-age=0, must-revalidate
Content-Length: 2132
Content-Type: application/atom+xml; charset=UTF-8

When the content is gzip-ed, which set of HTTP Response Headers is correct?

a)

HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.4
ETag: "8c9329975a5e17e029312bcda6228450"
Cache-Control: max-age=0, must-revalidate
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1091
Content-Type: application/atom+xml; charset=UTF-8

HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.4
ETag: "8c9329975a5e17e029312bcda6228450"
Cache-Control: max-age=0, must-revalidate
Vary: Accept-Encoding
Content-Encoding: deflate
Content-Length: 1073
Content-Type: application/atom+xml; charset=UTF-8

b)

HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.4
ETag: "8c9329975a5e17e029312bcda6228450;gzip"
Cache-Control: max-age=0, must-revalidate
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 1091
Content-Type: application/atom+xml; charset=UTF-8

HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.4
ETag: "8c9329975a5e17e029312bcda6228450;deflate"
Cache-Control: max-age=0, must-revalidate
Vary: Accept-Encoding
Content-Encoding: deflate
Content-Length: 1073
Content-Type: application/atom+xml; charset=UTF-8

Also, should "Vary: Accept-Encoding" be added even when there is no Content-Encoding?

Thanks,
Franklin Tse