On this page
A web page can load normally while its download link points to a missing file, an expired signed URL, or a response the browser cannot use as a file. To diagnose a download link not working but page loads, test the file request itself—not just the page—and check the response, authorization, browser behavior, and downloaded file contents.
Key Takeaways
- A working page does not prove that its download URL works; they are separate requests.
- Check the final URL, HTTP status, response headers, and body. A
200response could still contain an HTML login page instead of the file. - Test with a valid authorized session and a fresh link. Signed download URLs can expire or lose required query parameters.
Content-Type,Content-Disposition, and range responses can help explain browser and large-file problems, but not every download needs the same headers or range support.- Confirm the downloaded file is complete and matches an expected type or checksum. HTTP success alone does not establish correctness or safety.
1. Test the File Request, Not Just the Page
The page and the download usually have different URLs and may be served by different systems. For example, the page might come from your website while the file comes from a storage service or content delivery network. A successful page load only confirms that the page request worked.
Start by copying the exact download URL. In your browser, right-click the download control and copy its link address. If the site creates the link with JavaScript or uses a button instead, open your browser's developer tools, select Network, enable Preserve log, and click the control. Find the request that returns the file or the redirect to it.
Record the request URL, status, redirect chain, and whether it includes the expected query parameters. Treat signed URLs, cookies, and authorization headers as secrets: do not post them in tickets or public logs. A link copied without its query string may no longer be valid.
For a command-line check, use a public test file you control or an authorized staging file. Replace the example URL below with that file's URL:
URL='https://staging.example.com/files/sample.pdf'
curl --location --silent --show-error \
--dump-header response-headers.txt \
--output downloaded-file \
--write-out '\nFinal status: %{http_code}\nFinal URL: %{url_effective}\nContent type: %{content_type}\nBytes received: %{size_download}\n' \
"$URL"
This follows redirects, saves the response headers and body separately, and reports information about the final response. The header file can contain headers from multiple redirect steps; inspect the last response as well as the earlier ones. The command does not add your browser's login cookies, so a protected download may fail here even when it works in an authenticated browser.
A redirect to a sign-in page, an authorization error, or a missing-file response is more useful than merely seeing that the original page loaded. Do not assume a 200 means the file arrived: a server may return a login or error page with status 200.
Advertisement
2. Check Authorization and Link Expiry
If the download is restricted, repeat the test while signed in to the site with permission to access the file. Compare it with a fresh link generated for the same account. Check for:
- An expired signed URL or a link with a short validity window.
- A missing or expired login session, or an account without file access.
- A copied URL that is missing query parameters or has been altered by a messaging app.
- A redirect to a login or access-denied page.
- A system clock that is substantially wrong, which can affect time-limited links.
Use the browser's Network panel to inspect the request made in the authenticated session. Avoid copying session cookies or bearer tokens into shared commands, screenshots, or support messages. If you need to test authenticated access outside the browser, use your organization's approved method for handling credentials.
3. Read the Response Headers
Inspect the headers for the final file response, not only the first URL in a redirect chain.
| Header or result | What to look for |
|---|---|
| Status | A success response is expected for a completed download, but it does not prove the body is the intended file. 401 or 403 often indicates an authorization problem; 404 can indicate a wrong or unavailable file URL. Check the site's own behavior before drawing conclusions from a status alone. |
Content-Type | The media type should make sense for the file, such as application/pdf for a PDF. A generic type such as application/octet-stream can still be used for a downloadable file. An HTML type is a clue that you may have received a web page instead. |
Content-Disposition | attachment asks the browser to treat the response as a download, and a filename parameter can suggest a name. Its absence does not automatically make a response invalid; browsers can display some file types instead. |
Content-Length | When present, it can be compared with the number of bytes received. It may be absent or not useful in some transfer setups, so do not use it as the only completeness check. |
| Redirects | Check where the request ends. A redirect can lead to a login page, an expired storage URL, or a different host with its own access rules. |
Content-Type and Content-Disposition influence how a browser handles a response, but neither proves that the bytes match the claimed file type. A server can label the wrong content with a plausible header.
4. Check Range Requests for Large or Resumable Downloads
Some download clients request part of a file using a byte range, for example when resuming a transfer. You can test whether a server responds to a small range request with this command:
curl --location --silent --show-error \
--dump-header range-headers.txt \
--header 'Range: bytes=0-0' \
--output range-byte.bin \
--write-out '\nStatus: %{http_code}\nBytes received: %{size_download}\n' \
"$URL"
A server that honors this request typically returns 206 Partial Content and a Content-Range header describing the returned byte. If it returns 200 OK, it may have ignored the range and sent the full response instead; that alone does not mean an ordinary download is broken. A 416 Range Not Satisfiable response means the requested range cannot be served as requested. Check that the URL identifies the expected file and investigate further if the browser or download manager is specifically failing when it resumes a transfer.
For a reproducible comparison, use the same fresh staging link and repeat the request. If a range request produces an HTML page or an authorization error, investigate authentication and redirects before concluding that range support is the cause.
Advertisement
5. Compare Browser Behavior with the Response
Use the Network panel to find the file request and check its status, final URL, response headers, and transferred size. Then check the browser's download list for a blocked, interrupted, or renamed download. Test in a second browser or a private window if your site's login flow permits it; browser extensions, stored site data, or local settings can affect the result.
Also check whether the link is a normal file URL or a JavaScript action, such as a generated blob. For a cross-origin URL, browser handling can differ from what a page's download attribute suggests; the server response and browser policies matter. If the request never appears in the Network panel, inspect the link or click handler, browser console, and page scripts rather than debugging the file server first.
For mixed results, compare the same authorized URL in the browser and with curl. A command-line request without the browser's session can fail for a valid reason. Conversely, a successful command-line response does not rule out a browser policy, extension, or client-side problem.
6. Verify the Downloaded File
Check that the output exists, has a plausible size, and opens in the application intended for that format. On macOS or Linux, these commands can help with an initial check:
file downloaded-file
wc -c < downloaded-file
If you know the expected checksum from a trusted source, calculate a checksum and compare it. On macOS, use shasum -a 256 downloaded-file; on many Linux systems, use sha256sum downloaded-file. A mismatch can indicate that the file changed, was truncated, or is not the expected artifact. A matching checksum is useful only if the expected checksum itself came from a trustworthy channel.
Do not open an unexpected download just because the request returned a successful status. HTTP success does not prove that the content is intact, correctly identified, or safe to run. Treat unknown files cautiously and follow your organization's malware-scanning and file-handling procedures.
Common Mistakes
- Checking only the landing page. Test the request for the actual file, including redirects.
- Treating every
200as a valid download. Inspect the body and headers; it may be an HTML page or other error content. - Testing a private link without its session. A command-line request is not automatically authenticated like your browser.
- Using an old signed URL. Generate a fresh authorized link before comparing results.
- Assuming a missing
Content-Dispositionheader means failure. Some file types can open in the browser, and the header is not required for every download. - Calling
200on a range test a failure. The server may simply ignore the range and return the whole file. - Trusting the filename or MIME type as proof. Confirm the actual file, and use a trusted checksum when one is available.
Best Practices
- Reproduce the problem with a stable, authorized staging file and record the exact steps.
- Capture the file request and redirect chain in the browser's Network panel.
- Compare the browser result with a command-line request, accounting for authentication differences.
- Check response headers and inspect the saved body when a response looks suspicious.
- Test a range request only when resumable or large-file downloads are relevant; distinguish an ignored range from an error.
- Verify file size, expected format, and a trusted checksum where available. Redact tokens and signed query parameters from diagnostic evidence.
Conclusion
When a page loads but a download fails, isolate the file request and follow it through authorization, redirects, response headers, and browser handling. Then verify the downloaded bytes themselves. This separates a broken link or access problem from a client-side issue—and avoids mistaking a successful HTTP response for a correct, safe file.
What would your domain sell for?
A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.