Tag: nginx

  1. 跨域问题的解决方式

    下面是一个简单的CORS解决跨域问题的方案: 在服务端的nginx中加入以下配置: server { # 省略 location / { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; add_header 'Access-Control-Max-Age' 3600;# Tell client that this pre-flight info is valid for 1 hour add_header…

    on 跨域 CORS nginx