How Nginx computes the ETag header for files
How Nginx computes the ETag header for files
Curious how the ETag: header is generated in Nginx?
Turns out its a combination of the last modified time and the content length:
etag->value.len = ngx_sprintf(etag->value.data, ""%xT-%xO"",
r->headers_out.last_modified_time,
r->headers_out.content_length_n)
- etag->value.data;
You can determine the last modified time in hex by using this Unix line:
printf "%x" $(stat -c%Y <file>)
The content length is determined here:
stat --format="%s" <file>
visit link download