Observe compression negotiation
Use a generated wire-level request to observe coding selection without claiming a compressed transfer measurement.
- negotiation
- compression
- representations
Prediction
The server can select gzip when acceptable and identity otherwise, while Vary: Accept-Encoding tells caches which request field affected selection.
Controlled observation
Choose identity or gzip and use the generated cURL example to inspect the response fields. The Lab deliberately does not calculate or display compressed transfer bytes.
Explanation
Content-Encoding describes coding applied to the representation. Browser APIs
normally expose decoded content, so displayed text length is not wire transfer
size.
Cloudflare edge boundary
Cloudflare normally replaces the request’s visible Accept-Encoding field before
it reaches a Worker and exposes the client value separately when available. This
exercise therefore supports only the two generated presets. It is not an oracle
for arbitrary quality-value combinations.
When the original field is available, the handler honors q=0 and returns 406 Not Acceptable if both identity and gzip are forbidden. The response also uses
Cache-Control: no-transform so an intermediary does not silently turn the
identity demonstration into a different content coding.
Controlled exercise
Run this observation
Use the generated cURL example: browser Fetch forbids setting Accept-Encoding and reports decoded content, not reliable wire bytes.
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/compression- Permitted headers
- Accept-Encoding: identity
- 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
Content-Type: text/plain; charset=utf-8
Vary: Accept-Encoding
X-Lab-Content-Coding: identity
HTTP clarity makes negotiated representations observable. …Timing is browser elapsed time. Fetch hides Set-Cookie, raw wire bytes, reliable compressed size, and some redirect details.
Portable examples
'curl' '--include' '--compressed' '--request' 'GET' '--header' 'Accept-Encoding: identity' 'https://lab.httpclarity.com/v1/compression'Scroll horizontally to read any long lines.// Browser Fetch cannot reproduce this wire-level request.
// Use the cURL or PHP example instead.Scroll horizontally to read any long lines.<?php
$options = ['http' => [
'method' => 'GET',
'ignore_errors' => true,
'header' => 'Accept-Encoding: identity',
]];
$context = stream_context_create($options);
$body = file_get_contents('https://lab.httpclarity.com/v1/compression', 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
- RFC 9110 section 12.5.3 — Accept-Encoding (rfc)
- RFC 9110 section 8.4 — Content Coding (rfc)
- Cloudflare HTTP headers — Accept-Encoding (primary documentation)
