A PDF downloads but its browser preview fails: test ranges
Compare full and partial PDF responses, inspect Content-Range and byte lengths, and repair inconsistent range handling without treating 206 as an SEO requirement.
By Crawlito · 5 min read
In short
- A full download and a byte-range request exercise different response paths.
- A server may legitimately ignore a range and return the full representation.
- Verify the actual bytes and headers rather than assuming every PDF must return 206.
On this page
If a PDF downloads successfully but its browser preview stalls or fails, compare the full response with the byte-range requests the viewer makes. A proxy or origin may handle partial responses inconsistently. Repair the observed byte and header mismatch, then test the real viewer; do not treat 206 support as a universal requirement for search indexing.
The document itself may also be invalid or require features the viewer does not support. Establish which response path fails before changing storage headers.
Verify the complete document first
Download the public file with GET and inspect its type and content:
curl -sS -L -D full-headers.txt -o full.pdf \
'https://www.example.com/resources/manual.pdf'
file full.pdfOpen it with a supported PDF reader. Confirm the expected title and a later page, not just the first visible cover.
If the full response is an HTML error or a pointer file, repair that earlier problem. The PDF artifact guide covers a concrete case where a .pdf path does not contain a PDF.
Record the full file size and any representation validators such as ETag. These help compare the partial response with the same version of the document.
Do not assume that a browser saving a file proves the file is valid. Verify the actual document before focusing on range behavior.
Capture the viewer's partial request
Open the browser's Network panel while loading the preview. Inspect whether it sends a Range header, which URL it requests, and what response it receives.
MDN's range request guide explains partial requests, successful partial responses, and the case where a server ignores a range and returns the full representation.
Use the viewer's observed request as the baseline. A manually invented range may not reproduce the failing path.
Keep authorization and signed URLs private. If the document uses temporary access, expiry or signature constraints can interact with later requests. That is a separate hypothesis to test, not proof that the PDF is corrupt.
Record the request range, status, Content-Range if present, response length, and any error body. A screenshot of a blank viewer cannot identify these details.
Compare a small range with the full bytes
For a public document large enough to contain the requested range, a diagnostic request might be:
curl -sS -D range-headers.txt -o first-bytes.bin \
-H 'Range: bytes=0-99' \
-H 'Accept-Encoding: identity' \
'https://www.example.com/resources/manual.pdf'Compare the result with the beginning of the full representation under equivalent encoding conditions.
If the server returns 206, its Content-Range and body should describe the portion actually sent. If it returns 200 with the full file, that can be a valid decision to ignore the range.
Do not call a full 200 response a broken partial response solely because it differs from the request. The actual viewer's compatibility and the response contract matter.
If the response is 416, inspect whether the requested range is outside the current representation. A document replaced between requests can create a different scenario from a server that mishandles a valid range.
Trace the range through the delivery path
Check whether the CDN forwards, transforms, or answers the partial request and whether the origin supports the intended behavior.
Compare logs and response headers at the authorized infrastructure boundaries. Do not expose a private origin just to run the test.
Inspect compression and caching behavior. Byte offsets refer to a representation, so inconsistent transformations can make a naive comparison misleading. Keep the requested encoding explicit during diagnosis.
The content format guide helps separate compression from character or media-type problems.
Also check document replacement. If the URL is reused for a new file while a viewer has old metadata, validators and cache behavior need to keep the request coherent.
Use the actual platform's documentation for the repair. A generic “enable ranges” header does not implement correct partial delivery if the body handling is wrong.
Repair the response contract
Fix the component that produces inconsistent status, range metadata, or bytes. That may be a custom download handler, a proxy transformation, or an inappropriate cache rule.
Do not manually add Accept-Ranges or Content-Range headers to a handler that still sends arbitrary bytes. Headers should describe implemented behavior.
If the application intentionally serves full responses only, verify that the supported viewer can handle that path and that the file is otherwise delivered correctly.
For a custom handler, test start, middle, and end ranges against a known document, plus an out-of-range request. Keep the test bounded and use a file you control.
Preserve authorization checks on every supported request path. Partial access should not become a way to bypass the document's intended permissions.
Record the corrected component and the evidence that its response now matches the requested representation.
Verify the browser preview and the download
Repeat the original viewer sequence in a fresh session. Confirm the cover, a middle section, and a later page render correctly.
Then download the whole document again and compare it with the intended artifact. A partial-response fix should not break ordinary downloads.
Use a small acceptance matrix:
| Path | Evidence |
|---|---|
| Full GET | Correct complete PDF |
| Observed viewer range | Consistent supported response |
| Later page navigation | Correct content loads |
| Invalid range | Defined protocol behavior |
| Restricted document, if applicable | Intended access remains enforced |
The PDF readability guide covers text extraction and document usability after transport is correct. A working preview does not prove the text is selectable or meaningful to an extractor.
Keep the SEO conclusion proportionate
This repair establishes that the tested document delivery and viewer path work. It does not establish a universal search-engine requirement for range support.
A crawler may fetch the whole file through a different client. Do not infer its behavior from one browser viewer's implementation.
For an audit report, state the actual failure: the viewer requested a valid range, the proxy returned inconsistent metadata or bytes, and the repaired path now renders the intended pages.
Keep the public landing page useful and link to the stable document address. Readers should know what the file contains and whether it is the right version before opening it.
After storage or CDN changes, repeat the same representative document test. Range handling can change independently of article content or sitemap generation.
Also check whether the file changes between the viewer's requests. A document replaced in place during an open session can make a byte comparison difficult to interpret. Save the response validators and timestamps, and repeat the test against one stable published version before concluding that the range implementation is wrong.
For an intentional document update, verify the new complete download and then begin a fresh preview session. Keep any earlier viewer session as a separate observation. If the delivery stack rewrites, compresses, or transforms files, ask which representation the range offsets describe and compare bytes from that same representation. Mixing the original stored PDF with a transformed public response can produce an apparent mismatch that the test itself introduced. The evidence should identify the exact object version and delivery path used in every comparison.
Frequently asked questions
Must every PDF return 206 to be crawlable?
No. A full response can be valid. Diagnose the actual delivery failure rather than inventing a universal indexing rule.
Does Accept-Ranges alone prove ranges work?
No. Test an actual request and compare the returned status, metadata, and bytes.
Why can page one work while later pages fail?
The viewer may request different parts of the document later. Inspect those requests and the file's validity rather than assuming the first render proves everything.
Use the free Crawlito check on the document's public landing page after verifying the PDF delivery path.
Filed under Access and robots.txt. Topics: pdf, http-status, troubleshooting