Nginx Accept-Ranges

0 down vote favorite

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?

你可能感兴趣的:(Nginx)