跨域问题的案例演示
出现跨域问题会有什么效果?,接下来通过一个需求来给大家演示下:
(1)nginx的html目录下新建一个a.html
跨域问题演示
(2)在nginx.conf配置如下内容
server{
listen 8080;
server_name localhost;
location /getUser{
default_type application/json;
return 200 '{"id":1,"name":"TOM","age":18}';
}
}
server{
listen 80;
server_name localhost;
location /{
root html;
index index.html;
}
}
(3)通过浏览器访问测试



