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; } }
钻研不易,转载请注明出处......
sa1
原文:https://www.cnblogs.com/s313139232/p/14684724.html