首页 > 解决方案 > “accept-ranges”标头设置为“none”而不是“bytes”

问题描述

在向端点发出 curl 请求后,我得到了以下响应

HTTP/2 200 
date: Mon, 24 Jun 2019 10:11:39 GMT
content-type: text/html; charset=UTF-8
content-length: 1952
server: nginx
x-powered-by: Express
cache-control: public, max-age=0
last-modified: Tue, 21 May 2019 10:11:37 GMT
vary: Accept-Encoding
x-frame-options: SAMEORIGIN
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-xss-protection: 1; mode=block;
accept-ranges: bytes

最终,我不想要accept-ranges: bytes,而是必须是"accept-ranges: none"

我尝试在 nginx 配置中进行以下操作

 server {
 ..... 
 .....
 .....
       location / {
        ......        
        ......
              max_ranges 0;
              proxy_force_ranges on;
        ......
        }
  }

可能是什么问题?

标签: httpnginxcurlhttp-accept-header

解决方案


您是否尝试删除“proxy_force_ranges on”?它为来自代理服务器的响应启用字节范围支持,而不管这些响应中的“Accept-Ranges”字段如何。


推荐阅读