其他分享
首页 > 其他分享> > 初探前后端分离跨域问题

初探前后端分离跨域问题

作者:互联网

举例:react nginx(8001) springboot(tomcat8080)
后端解决跨域问题:
    前端请求真实的api地址 如:http://localhost:8080/hello/hello/1
    后端@CrossOrigin配置类或方法
前端解决跨域问题:
    前端请求 8001同源地址+api地址 如:http://localhost:8001/api/hello/hello/1
    nginx.conf 
    location /api {
        proxy_pass   http://localhost:8080/; # 后端接口 IP:port
    }

标签:http,跨域,分离,8001,api,初探,hello,localhost
来源: https://blog.csdn.net/lin_rongwu/article/details/106910149