Headers
On this page
Every response from the edge carries a few headers of ours, the most useful being X-CDN-Cache, and every request to your origin carries a few that say who really asked. A cached response also keeps a fixed set of your origin's own headers.
Headers on every response#
| Header | Value |
|---|---|
| X-CDN-Cache | HIT, MISS or BYPASS: see below |
| X-CDN-Location | The id of the location that answered: the same ids the statistics API uses in NODES |
| X-CDN-Name | CacheGenie CDN |
| Server | CacheGenie CDN, replacing whatever your origin sent, on a response that carries your content; the edge's own pages do not carry it |
| Accept-Ranges | bytes, on a response that carries your content |
| X-Content-Type-Options | nosniff |
| Age | On a hit, the seconds since the copy was fetched from your origin or last refreshed, wherever it was stored; 0 on the request that fetched it from your origin |
| Alt-Svc | h3=":443"; ma=86400, on every HTTPS response over HTTP/1.1 or HTTP/2: the browser may make its next requests over HTTP/3, and stays on HTTP/2 by itself where its network blocks it. A browser that reads DNS HTTPS records learns the same from cdn.cachegenie.com before its first request (see The DNS). Your origin's own Alt-Svc is never passed on |
Header names are case-insensitive; over HTTP/2 and HTTP/3 a client sees them in lower case.
X-CDN-Cache#
- HIT: served from the edge's copy, or from a copy the zone's Home PoP or another of our locations already held (see Caching strategy), since either way your origin was not asked. A copy that has expired and is being refreshed in the background reads HIT as well, since the viewer was served from it.
- MISS: fetched from your origin on this request: the first request for a file, a piece of a large file the edge did not have, or a response that could not be stored, such as an error, a redirect or a response marked
no-store. The edge's own pages, an error page or a refusal, read MISS as well. - BYPASS: passed straight through because of the request itself: a method other than GET and HEAD, an
Authorizationheader, or a cookie on a zone that does not strip them. The maintenance page reads BYPASS too.
Headers added by a setting#
| Header | When |
|---|---|
| Strict-Transport-Security: max-age=31536000 | Force SSL is on for the hostname, on a response that carries your content |
| Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, HEAD, OPTIONS Access-Control-Max-Age: 86400 | Add CORS headers is on, for .css, .eot, .ttf, .woff and .woff2 files |
| Link: <origin url + path>; rel="canonical" | Add canonical headers is on, on a standard origin, replacing any Link your origin sent |
| X-CDN-Token | A signed link was refused: the reason. See Token authentication |
| X-CDN-Block | A visitor was refused by a blocking rule: the rule. See Blocking visitors |
| X-CDN-Limit | A request was refused because one address asked too much at once (rate, in-flight or origin), or because the zone's requests already held half of those that location had waiting on origins and this one waited 20 seconds for a place (zone). See Error pages and status codes |
| X-CDN-Loop | reported, on the 502 page when your origin leads back to us, directly or through a proxy of yours: we have found the loop and logged it |
| Retry-After | On the maintenance page (300 seconds), when a request could not be served just now (30), and on a 429 (the seconds until that address may ask again) |
What a cached response keeps of your origin's headers#
A hit replays only these, the first value of each:
Content-Type, Content-Encoding, Content-Language, Content-Disposition, Cache-Control, Expires, ETag, Last-Modified, Vary, every Access-Control-* header, Timing-Allow-Origin, Cross-Origin-Resource-Policy, Content-Security-Policy, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Link, X-Robots-Tag.
A response the edge compressed says so: Content-Encoding is br (Brotli) or gzip, Vary names Accept-Encoding, and the ETag is your origin's made weak (see How caching works).
The response to the request that fetched a file of 10 MB or less from your origin relays everything else your origin sent as well, apart from connection headers, Alt-Svc, Age, Server and the X-CDN-Name, X-CDN-Location and X-CDN-Cache names, which are ours. A larger file is answered from the stored set on every request, the first included. So a custom header from your origin is seen once on a small file and never on a large one. Link is replaced by the canonical one while Add canonical headers is on, and Set-Cookie is removed from every response when Strip response cookies is on. Cache-Tag and Surrogate-Key are kept for purges by tag and never sent to a viewer.
What your origin receives#
| Header | Value |
|---|---|
| Via | 1.1 CacheGenie-CDN (z={ZONE_ID}; t={time}; s={signature}), on every request: the same signed marker as CDN-Loop, in the comment of our entry |
| CDN-Loop | CacheGenie-CDN; z={ZONE_ID}; t={time}; s={signature}, our entry signed for the zone, after any other CDN's entries the request came with (RFC 8586), on every request. A request that comes back to us carrying it is a loop and is answered with the 502 page |
| User-Agent | The viewer's, on the request that fetches a file or passes through. CacheGenie-CDN/ and our engine's version when the edge fetches for itself: a further piece of a large file, or the refresh of an expired copy; and after them loop-probe/ and a token on a loop probe, the extra requests that also carry cdn-loop-probe= on the query and, on two of them, cdn-loop-probe. and the token in the path |
| X-Forwarded-For | The viewer's address, exactly one, on the request that fetches a file or passes through; anything the viewer sent in that header is removed rather than appended to |
| X-CDN-Connecting-IP | The same address, on every zone, in a header no client can prefill: the edge writes it from the connection it accepted, and refuses a request that arrives already carrying one as a loop |
| X-CDN-Country | The viewer's country as a two-letter ISO 3166-1 code (GB), beside X-CDN-Connecting-IP; left out when the address cannot be placed. An answer that differs by country must say Vary: X-CDN-Country, which keeps it out of the cache |
| X-CDN-ASN | The number of the network the viewer's address belongs to (13335), beside X-CDN-Connecting-IP; left out when no network announces it |
| X-Forwarded-Proto | http or https, as the viewer connected, on the request that fetches a file or passes through; not on the edge's own fetches |
| X-Forwarded-Host | The hostname the viewer used |
| Host | The hostname from the Origin URL, or the Host header field when set; the viewer's hostname when Forward host header is on; the endpoint's host on a tunnel zone when neither is set; always the bucket's own for a bucket origin |
| Range | On the first fetch of a file (its first 10 MB) and on each piece of a large file; its first byte (bytes=0-0) for a HEAD of a file not yet cached; a viewer's own range on a pass-through; none on the refresh of a file stored whole |
| If-Range, If-None-Match, If-Modified-Since | On the edge's own fetches: If-Range with each piece of a large file (a strong ETag, or else the Last-Modified date), the other two on the refresh of an expired copy |
| Accept-Encoding | On a cache fill, the bucket the viewer's request was sorted into: br, gzip, br, gzip or identity; on a pass-through, the viewer's own value |
Every fetch is a GET, a HEAD from a viewer included. A cache fill forwards only Accept, Accept-Language and User-Agent from the viewer's request (never Origin: the CORS headers a viewer's site is given are asked separately, with its Origin and a one-byte Range, see CORS and the cache), and a bypass forwards those plus Accept-Encoding, Range, the conditional headers (If-None-Match, If-Modified-Since, If-Range), Authorization, Cookie where it is not stripped, Content-Type, Origin and the CORS preflight headers; Referer is never forwarded, and Authorization never reaches a bucket.
X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host, X-Real-IP, Forwarded, X-CDN-Connecting-IP, X-CDN-Country and X-CDN-ASN from a client never reach your origin: ours are written fresh by us and the others dropped. Of the client's other headers, only those listed above reach it.
To log or act on the viewer's address, read X-CDN-Connecting-IP, and accept it only from our addresses (Edge addresses): most frameworks need telling to trust a proxy first (Laravel's TrustProxies, nginx's real_ip_header).