Nginx解决跨域问题No ‘Access"/>
Nginx解决跨域问题No ‘Access
浏览器控制台报错
Access to XMLHttpRequest at ‘’ from origin
‘’ has been blocked by CORS policy: No
‘Access-Control-Allow-Origin’ header is present on the requested
resource.
解决办法
使用nginx在server块下或location块下为请求添加请求头都可以解决跨域问题。
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET,POST,DELETE';
add_header 'Access-Control-Allow-Header' 'Content-Type,*';
更多推荐
Nginx解决跨域问题No ‘Access
发布评论