Observe ETag revalidation

Observe how If-None-Match can validate a stored representation without retransmitting it.

  • caching
  • validators
  • conditional requests

Prediction

A matching If-None-Match on GET should produce 304, while a non-matching tag should produce the normal fixed representation.

Controlled observation

The future controls will choose only unconditional, matching, and non-matching requests and will display content absence separately from an empty representation.

Explanation

The entity tag identifies the selected representation. A 304 is useful only with the corresponding stored response.

Controlled exercise

Run this observation

Use the generated cURL example: browsers cannot set If-None-Match cross-origin without a broader preflight contract.

Browser run unavailable for this wire-level observation; use a portable example below.

Ready. No request has run.

Controlled request

Method
GET
URL
https://lab.httpclarity.com/v1/etag-revalidation
Permitted headers
None
Body
None

Browser-observed response

No response yet. The explanation and examples remain useful without JavaScript or the Worker.

Timing is browser elapsed time. Fetch hides Set-Cookie, raw wire bytes, reliable compressed size, and some redirect details.

Portable examples

cURL

              'curl' '--include' '--request' 'GET' 'https://lab.httpclarity.com/v1/etag-revalidation'
            

Fetch API

              // Browser Fetch cannot reproduce this wire-level request.
// Use the cURL or PHP example instead.
            

PHP

              <?php
$options = ['http' => [
    'method' => 'GET',
    'ignore_errors' => true,
]];
$context = stream_context_create($options);
$body = file_get_contents('https://lab.httpclarity.com/v1/etag-revalidation', false, $context);
var_dump($http_response_header, $body);
            

Need a full API client? Copy the generated cURL command, then import it in Hoppscotch. HTTPClarity sends no request data to Hoppscotch.

Continue in Hoppscotch (opens in a new tab)

Primary sources