简体   繁体   English

Chrome 网络错误 - 下载 PDF

[英]Chrome Network Error - Downloading PDF

In our application, we have a users downloading PDF through a AJAX call -- basically we have a table listing a lot of PDF files and when the user clicks on a filename, an AJAX call is made to a Servlet which serves the file as reponse.在我们的应用程序中,我们有一个用户通过 AJAX 调用下载 PDF——基本上我们有一个列出大量 PDF 文件的表,当用户单击文件名时,将对 Servlet 进行 AJAX 调用,该 Servlet 将文件作为响应.

The Content-Length is set for the response along with other required params (Content-Disposition, Content-Type etc).为响应设置 Content-Length 以及其他必需的参数(Content-Disposition、Content-Type 等)。 We have observed that for a specific set of users, the download fails with a Network Error.我们观察到,对于一组特定的用户,下载失败并出现网络错误。 The download is initially initiated and begins but after some time the download just stops processing and this error is thrown.下载最初启动并开始,但一段时间后下载停止处理并抛出此错误。 This has been the behavior with both IE and Chrome.这是 IE 和 Chrome 的行为。

Initially, the content-length was not provided and hence defaulted to chunked transfer but this has been changed now.最初,未提供内容长度,因此默认为分块传输,但现在已更改。 Even with chunked transfer we did have the same issue.即使使用分块传输,我们也遇到了同样的问题。

We have run through the steps provided in Chrome documentation (clearing cookies etc) but there has been no respite.我们已经完成了 Chrome 文档中提供的步骤(清除 cookie 等),但没有任何喘息的机会。 We did run through the net-exports feature in Chrome and they have the following as the last few lines as -我们确实在 Chrome 中运行了 net-exports 功能,他们在最后几行中有以下内容——

t=237104 [st=161960]  DOWNLOAD_ITEM_INTERRUPTED
                      --> bytes_so_far = "0"
                      --> interrupt_reason = "NETWORK_FAILED"
t=237104 [st=161960] -DOWNLOAD_ITEM_ACTIVE

The users who are unable to download are able to download PDF from other sites.无法下载的用户可以从其他站点下载PDF。 If we host a static PDF in our site, the users are able to access it as well.如果我们在我们的网站上托管静态 PDF,用户也可以访问它。

Any pointers on what would need to be our next lookout?关于我们下一个监视点需要什么的任何指示?

(The users connect to a web server Apache HTTPD) (用户连接到 Web 服务器 Apache HTTPD)

Thanks, Aravind谢谢,亚拉文

I had the Network Error issue while downloading the PDF files from Jasper.从 Jasper 下载 PDF 文件时遇到网络错误问题。 I followed the below steps to fix the downloading issue with the Chrome.我按照以下步骤解决了 Chrome 的下载问题。

  1. Enter the chrome://settings/content/pdfDocuments?search=pdf into the address bar of the Chrome.在 Chrome 的地址栏中输入chrome://settings/content/pdfDocuments?search=pdf
  2. Turn ON the option " Download PDF files instead of automatically opening them in Chrome "打开选项“下载 PDF 文件而不是在 Chrome 中自动打开它们

Change PDF MIME Type in Web Server or Response Headers from更改 Web 服务器或响应标头中的 PDF MIME 类型

application/pdf
to
application/octet-stream应用程序/八位字节流

This problem is when is enabled gzip compression and/or HTTP/2这个问题是什么时候启用 gzip 压缩和/或 HTTP/2

Enable http/2 for SSL connections is a hugely valuable performance setting.为 SSL 连接启用 http/2 是一个非常有价值的性能设置。 However http2 expects the reported size to match what the webserver reports for streamed content.然而,http2 期望报告的大小与网络服务器报告的流内容相匹配。

The problem occurs in Cloudflare to.问题出现在Cloudflare中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM