使用 xlsx 库以 angular 形式下载大型 excel 文件(net::ERR_INCOMPLETE_CHUNKED_ENCODING 200)

使用 xlsx 库以 angular 形式下载大型 excel 文件(net::ERR_INCOMPLETE_CHUNKED_ENCODING 200)

我正在使用 angular + springboot 下载 excel 文件,api 返回 application/json 文件。transfer-encoding:chunked 始终处于启用状态,我看到响应返回 http 1.1。

我在 stackoverflow 上发布了这个问题,但还没有得到任何解决方案。请帮忙,因为我已经困惑了好久,不知道该怎么办了。

错误是 polyfills.35a5ca1855eb057f016a.js:1 POSThttps://fff.com///RETRIEVE_ALL_BLOCKSnet::ERR_INCOMPLETE_CHUNKED_ENCODING 200 nginx.conf 文件

worker_processes  1;

events {
 worker_connections  1024;
}

http {
  gzip  on;
  gzip_http_version 1.0;
  gzip_comp_level 2;
 gzip_min_length 1100;
 gzip_buffers     4 8k;
 gzip_proxied any;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/javascript
application/x-javascript
text/xml
text/plain
text/x-component
application/javascript
application/json
application/xml
application/rss+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;
gzip_static on;
{"
   gzip_proxied  expired no-cache no-store private auth;
   gzip_disable  "MSIE [1-6]\.";
   gzip_vary on;

 server {
     listen 8080;
     server_name  localhost;

   root   /usr/share/nginx/html;
   index  index.html index.htm;
   include /etc/nginx/mime.types;

  location / {
     try_files $uri $uri/ /index.html;
  }

我的回复标头:

HTTP/1.1 200
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Connection: keep-alive
Content-Type: application/json
Date: Fri, 08 Jul 2022 18:54:48 GMT
Strict-Transport-Security: max-age=15724800; includeSubDomains
Transfer-Encoding: chunked
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers

请求标头:

Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 0
Authorization: Bearer
Cache-Control: no-store
Connection: keep-alive
Content-Length: 292
Content-Type: application/json
If-Modified-Since: 0
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.143 
 OpenFin/25.100.70.3 Safari/537.36
 max-age: 0

相关内容