On this page
A successful HTTP response does not prove that a download link serves the intended PDF. The server might return a login page, an outdated document, or a different file with a PDF-like name. This checklist shows editors and website administrators how to check the response and then verify the downloaded document itself.
Key Takeaways
- Follow the link through any redirects and inspect the final response, not just the first status code.
- Check the final response’s
Content-Typeand, if present,Content-Disposition; neither proves that the document is correct. - Download and open the file, then compare its contents with the approved document.
- Test public links without an existing login session. Keep confidential files and access-bearing URLs out of third-party services.
1. Choose an authorized test and establish the expected file
Use a controlled document that your organization hosts and that you are authorized to check. Before testing, record the expected title, revision or publication date, and any distinctive content, such as a section heading or page count. If you have the approved original, keep it available for comparison.
Use a non-confidential test document for any external checking service. A URL can itself contain sensitive information, such as a signed token, even if the document is not confidential.
Advertisement
2. Check the response and redirects
Open the link in a browser. If you need to inspect the response details, open the browser’s developer tools, select the Network panel, and then activate the download link. Enable the option to preserve the network log if you need to see requests across page navigations. Select the request and inspect its status, response headers, and redirect chain. Browser labels vary.
- Initial response: A redirect may be expected, for example when a publishing URL points to a file storage location.
- Final response: Check whether the final request succeeds and whether it lands at the expected destination. A success status alone does not establish that the response is a PDF.
- Unexpected destination: Investigate redirects to a sign-in page, error page, unrelated domain, or expired storage link.
- Access requirements: If the file should be public, repeat the test in a private browsing session without signing in. If it should be restricted, check both authorized and unauthorized access according to your organization’s policy.
An HTTP Status Checker, if you choose to use one, is only a response-checking aid: use it for the response checks it actually supports. It cannot establish that the downloaded document is the intended one. Do not submit confidential URLs or files to a third-party service.
Inspect the final headers
Look at the headers for the final file response rather than only those on a redirect:
Content-Typedescribes the media type declared by the server.application/pdfis the usual value for a PDF. A value such astext/htmlmay indicate that the server returned a login or error page instead. An incorrect or generic type does not by itself prove that the file is invalid; open and inspect it.Content-Disposition, when present, can indicate whether content is intended to display inline or be downloaded as an attachment, and can suggest a filename. The suggested filename may differ from the last part of the URL. It is a label, not proof of the file’s identity.
If you see an unexpected type, filename, or redirect, record the final URL and relevant headers for the site administrator. Treat URLs and headers as potentially sensitive when sharing them.
3. Download and verify the document
- Save the file from the link. If the browser opens a PDF viewer instead, use its download control and note the saved filename.
- Open the saved file in a PDF reader. Confirm that it opens without an error and displays the expected document, not an HTML login page saved with a
.pdfextension. - Compare the title, revision date, page count, and distinctive content with the approved source. Check important pages, not just the cover: a stale or incomplete PDF can have the right title.
- If exact file identity matters, compare a cryptographic hash of the download with a trusted hash for the approved original. A mismatch means the files differ, though it does not by itself explain why.
- If the content is wrong, report the page containing the link, the link destination, the final response details, and the discrepancy. Avoid attaching confidential files or sharing access tokens unnecessarily.
Advertisement
4. Optional: inspect a controlled link with curl
If you are comfortable using a terminal, curl can save both the response headers and the downloaded body for inspection. Replace the example URL below with a URL for a document you are authorized to check. The example address is illustrative, not a test document.
url='https://example.com/replace-with-authorized-test.pdf'
curl --location --max-redirs 5 --max-time 30 \
--dump-header pdf-headers.txt \
--output pdf-download.bin \
--write-out 'Final URL: %{url_effective}\nHTTP status: %{http_code}\nContent-Type: %{content_type}\n' \
"$url"
The command follows redirects, saves response headers to pdf-headers.txt, and saves the final response body to pdf-download.bin. Inspect the last response’s headers; earlier blocks can describe redirects. A successful command does not prove that the body is the right PDF, and an HTTP error response may still have a saved body. Open the downloaded file and perform the content checks above.
Use this only with a destination you trust and are authorized to access. Avoid placing credentials or sensitive signed URLs in shell history, and protect or delete the saved files when finished. Authentication-dependent downloads may require a browser session or an approved organization-specific procedure.
Common Mistakes
- Stopping at a success status: A login or error page can be returned successfully.
- Checking only the initial URL: A redirect can lead to a different file or an access page.
- Trusting the URL extension or downloaded filename: Either can say
.pdfwhile the content is wrong. - Treating headers as content verification: A PDF media type and a plausible filename are useful clues, not proof.
- Testing only while signed in: Your session may hide a public-access problem.
- Uploading confidential material to an external tool: Use approved internal methods for sensitive documents and links.
Best Practices
Check the published link after each document replacement, and include both the response check and the content comparison in your publishing checklist. When reporting a problem, distinguish an incorrect header or filename from an incorrect document: they may require different fixes.
This article’s code and documentation details were not independently verified in this run. Consult the MDN documentation for Content-Type and Content-Disposition and your installed curl documentation when confirming behavior in your environment.
Conclusion
A reliable PDF link check has two parts: inspect the response through its final destination, then open the downloaded file and compare it with the approved document. Neither the status code nor the filename can replace that final verification.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.