nginx配置允许跨域
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; } }
钻研不易,转载请注明出处......
- 上一篇 »php 服务端允许跨域访问
- 下一篇 »PHP允许跨域终极解决办法