CDN Checks Return 200 but Downloads Fail? Compare HEAD, GET, and Cache Updates
Create Time:2026-11-24 17:23:46
浏览量
1069

Header-only monitoring succeeds while the response body transfer fails

A monitor reports 200 while visitors encounter interrupted downloads, empty files, or scripts that fail to load. Check whether the monitor sends only HEAD. That method observes status and headers without downloading the body that GET would return. A successful connection and response headers do not establish successful delivery of the whole file.

Keep the method, URL, request conditions, and cache state explicit when comparing results. Avoid turning a lightweight probe into frequent large downloads, and do not infer cache corruption solely from different status codes.

Identify what the monitor sends

curl -I sends HEAD; curl -i includes response headers in its output. They are different options. Monitoring services, browsers, and SDKs may use different methods, User-Agent values, or redirect policies. Save the probe configuration, timestamp with time zone, URL, method, request ID, and response headers.

HTTP defines HEAD as having the same semantics as GET except that the response has no content. Servers should normally return the same headers, but may omit some fields whose values are determined only while generating the content. A missing dynamically generated header is not automatically an implementation error.

When a HEAD response includes Content-Length, it describes the size that the corresponding GET would return, not bytes delivered as a HEAD body. Treating that value as proof of a complete download produces false confidence.

Compare requests against a small public object

The following Linux shell example reads a known, small public asset. Replace the example URL. It changes no configuration and issues no purge; it has not been executed against your production environment.

url='https://cdn.example.com/assets/check.js'

curl -sS --max-time 15 --head \
  -D head.headers -o /dev/null "$url"

curl -sS --compressed --max-time 15 \
  -D get.headers -o get.body \
  -w 'code=%{http_code} bytes=%{size_download} total=%{time_total}\n' "$url"

wc -c get.body
sha256sum get.body
grep -Ei '^(HTTP/|content-length:|content-type:|content-encoding:|etag:|age:|location:)' \
  head.headers get.headers

These requests do not follow redirects by default, making the first Location visible. Verify that the target is trusted before testing the complete chain separately. Align authentication, query parameters, and headers that affect representation selection before attributing differences to the method. In particular, --compressed changes content-encoding negotiation for the GET test; align that header for a strictly controlled comparison.

--compressed decodes the saved body. The file size reported by wc therefore need not match a compressed representation's Content-Length or transfer byte count. State which representation each measurement describes.

Separate status failures from body-transfer failures

If HEAD returns 200 but GET returns 403, 404, or 405, inspect routing, method-based WAF rules, authentication, and proxy policy. A shortcut health handler may return success without reading the actual object or backing storage. HEAD success does not demonstrate storage readability.

If GET returns 200 but the file is truncated, retain curl's exit status and error output along with the actual size and body hash. A server can send 200 headers before a connection fails. Correlate upstream timeouts, storage errors, buffering behavior, and network resets using request identifiers.

If GET returns 200 with a login page, error JSON, or HTML fallback, check Content-Type and expected content features. A final status below 400 is not sufficient acceptance criteria for a static asset.

Do not assume HEAD has no cache effects

HEAD responses can be cached and can update metadata associated with a stored GET response under HTTP caching rules. RFC 9111 Section 4.3.5 specifies conditions for updating or marking stored responses stale using HEAD results. Whether a CDN turns a client HEAD into an origin GET or shares cache entries in a particular way depends on its implementation.

An origin GET log entry does not alone establish that the client sent GET. Likewise, a bodyless HEAD response does not establish that no origin object was read. Correlate client, edge, and origin evidence in the same time window.

If source metadata, ETags, or file versions are wrong, a metadata update cannot establish content correctness. Repair origin consistency rather than removing validators or broadening shared-cache scope to conceal the mismatch.

Test hits and authorized origin fetches separately

A probe that always hits the edge can temporarily hide an origin outage. To check the origin, use a provider-supported diagnostic or an established authorized operational path, then confirm the backend received the request. Avoid unbounded random query strings or a global purge to manufacture origin traffic.

For multiple origins, compare the same object's version, size, and hash on each backend. Monitor application health, static delivery, and database dependencies separately instead of letting one simple 200 represent all availability.

For large transfers, use low-frequency representative samples with an explicit bandwidth budget. A Range read validates only the requested portion; it does not replace full-file integrity checks. Range support also requires its own verification.

Monitor the failure that users actually experience

Retain lightweight HEAD probes for connection, certificate, and header checks where useful. Add a low-frequency GET of a small known object to verify content type, length, and hash. For dynamic responses, validate stable fields rather than treating every changing full-body hash as an incident.

Set probe timeouts, frequency, and alert windows. Record status, client completion result, time to first byte, total time, and content validation separately. Use dedicated least-privilege test identities for authenticated checks, and keep credentials and sensitive bodies out of shared logs.

Save monitoring and cache rules before changes. Validate on a few paths, then expand. Acceptance should cover cache hits, authorized origin fetches, representative networks, and the method used by real clients. Close a download incident when the expected body arrives intact, rather than when a HEAD probe returns 200 again.

References

Verify CDN-specific HEAD origin-fetch and caching behavior against the deployed platform configuration and official documentation.