nginx配置允许跨域

在代理配置的位置添加允许跨域代码:

示例:

        location /Tileset/ {
            root  Tileset;
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
            add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';  # 如果有自定义head,需要添加在此处

            if ($request_method = 'OPTIONS') {
                return 204;
            }
        }

 

 

 

 

钻研不易,转载请注明出处......

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
猜你喜欢
  • 2022-02-27
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-03-08
相关资源
相似解决方案