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

Choose an unconditional, matching, or non-matching request. The generated wire-level examples distinguish a 304 response without content from a normal 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.

Interactive controls require JavaScript. The static response and portable examples remain available 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 live response yet. The representative static example remains useful without JavaScript or the Worker.

Static response example

HTTP/1.1 200 OK
ETag: "httpclarity-etag-v1"
Cache-Control: private, no-cache

HTTPClarity fixed validator fixture.

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'
Scroll horizontally to read any long lines.
Fetch API
// Browser Fetch cannot reproduce this wire-level request.
// Use the cURL or PHP example instead.
Scroll horizontally to read any long lines.
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);
Scroll horizontally to read any long lines.

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