Nginx Accept-Ranges

I have an app working from localhost:8888 using tornado, and this is the headers i'v set:

 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")

the app on localhot:8888 needs to get a static file from locahost:80, and the nginx server on localhost:80 looks like this:

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;
}

but the error in the browser is persistent:

Refused to get unsafe header "Accept-Ranges" 

i tried to add all those headers above after seeing this issue where the concerned op gave as his solution making the static pdf server return the headers

Access-Control-Allow-Headers: Range
Access-Control-Expose-Headers: Accept-Ranges, Content-Encoding, Content-Length,

how do i achieve that in nginx and tornado?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值