1
我有一個應用程序從本地主機的工作:使用龍捲風8888,這是頭心中已經設置:如何在nginx中允許標題「Accept-Ranges」?
def set_default_headers(self):
self.add_header("Access-Control-Allow-Origin", "*")
self.add_header("Access-Control-Expose-Headers","Accept-Ranges")
self.add_header("Access-Control-Expose-Headers","Content-Encoding")
self.add_header("Access-Control-Expose-Headers"," Content-Length")
self.add_header("Access-Control-Expose-Headers","Content-Range")
上localhot應用:8888需要得到的locahost靜態文件:80, 和localhost上的nginx服務器:80看起來是這樣的:
server {
listen 80;
server_name localhost;
root /var/www/statics;
passenger_enabled on;
passenger_use_global_queue on;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Origin [http://localhost:8888;]
add_header Access-Control-Expose-Headers Accept-Ranges;
add_header Access-Control-Expose-Headers Content-Encoding;
add_header Access-Control-Expose-Headers Content-Length;
add_header Access-Control-Expose-Headers Content-Range;
add_header accept_ranges bytes;
client_max_body_size 512M;
}
但在瀏覽器中的錯誤持續存在:
Refused to get unsafe header "Accept-Ranges"
我試着添加所有這些頭上面看到這個 issue後,其中有關運給了他的解決方案使得靜態的PDF服務器nginx的和龍捲風返回頭
Access-Control-Allow-Headers: Range
Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length,
我如何做到這一點?