Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Apache, <a href="http://httpd.apache.org/docs/2.2/mod/core.html#fileetag" rel="nofollow">ETags are handled as a core feature</a>. The ETag is computed as a hash of several values. You can use the <code>FileETag</code> directive in your <code>httpd.conf</code> or <code>.htaccess</code> file to define conditional behavior for which values to include in the hash, but as you pointed out, your options are limited to:</p> <ul> <li><code>INode</code> - your file's i-node number on the particular server it's served from</li> <li><code>MTime</code> - the timestamp (in millis) of the server your file is served from</li> <li><code>Size</code> - the size of your file in bytes</li> <li><code>All</code> - all of the above</li> <li><code>None</code> - none of the above</li> </ul> <p>If you want truly custom ETag generation, you would definitely be best off writing an Apache module. However if you need a quick-and-dirty fix, you can generate your own tags by routing your requests to a PHP script and appending the <code>Etag</code> header in the script. The route might look like this in your <code>httpd.conf</code> or <code>.htaccess</code> file:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} \.png$ # This example looks for .png requests RewriteRule ^(.*)$ /gentag.php?path=$1 [B] # ...and routes them to a PHP script </code></pre> <p>The PHP script might look like this:</p> <pre><code>&lt;? $path = $_GET['path']; // Grab the filepath from GET params $cont = file_get_contents($path); // Get file contents to hash $hash = crc32($cont); // Create your own ETag hash however you like header("Etag: $hash"); // Send the custom Etag header echo $cont; // Dump the file contents to output ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload