前端把api的baseurl写成和前端部署域名相同
再nginx将/api转发到真实服务器地址
location /api {
proxy_set_header Origin "http://xxx.xxx.com";//真实后端ip
proxy_set_header Host "http://xxx.xxx.com";
rewrite ^/api/(.*) /$1 break;
proxy_pass "http://xxx.xxx.com";
}