IM Used
Production Risk
Low. This is a rare and optional optimization ('A-IM' stands for 'Applied Instance Manipulation'). Most modern compression is handled via Content-Encoding.
The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance. The server must generate a 226 response if it has fulfilled a GET request and the response represents the result of one or more instance manipulations.
- 1A client requests a resource and indicates it can accept a delta-encoded response using the 'A-IM' header.
- 2The server determines it can send a more efficient response by describing changes from a version the client already has cached.
- 3This reduces bandwidth by only sending the difference (delta) between documents.
A client that has a cached version of a large document requests it again, and the server sends only the changes made since the client's version.
GET /large-doc.html HTTP/1.1 Host: example.com A-IM: gdiff
expected output
HTTP/1.1 226 IM Used
Fix
Signal 226 IM Used when returning a delta-encoded response
// Server-side concept: returning a delta response (RFC 3229)
// Most applications use Content-Encoding: gzip/br instead — 226 is rare.
// If you implement delta encoding, the server must:
// 1. Check the client's A-IM and If-None-Match headers
// 2. Compute the delta between the cached and current version
// 3. Respond with 226 and the correct headers
HTTP/1.1 226 IM Used
ETag: "v3"
IM: gdiff
Content-Type: application/gdiff
// Client must apply the delta to its cached copy to reconstruct the full document.
// For most use cases, standard HTTP caching with ETags achieves similar
// bandwidth savings without the complexity of delta encoding:
app.get('/large-doc', (req, res) => {
const etag = computeEtag(document);
if (req.headers['if-none-match'] === etag) {
return res.status(304).end(); // Not Modified — client cache is current
}
res.setHeader('ETag', etag);
res.send(document);
});Why this works
226 IM Used is the response code for RFC 3229 instance manipulation (delta encoding). The server computes a diff between the client's cached version (identified by If-None-Match) and the current version, then sends only the diff with the applied manipulation identified in the IM header. This is rarely implemented in practice — standard 304 Not Modified with ETag caching achieves most of the same bandwidth savings with far less complexity.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev