方法一,通过 CORS 跨域,可以让后退设置一下Access-Control-Allow-Origin: http://api.bob.com Access-Control-Allow-Credentials: true Access-Control-Expose-Headers: FooBar Content-Type: text/html; charset=utf-8方法二,一般情况前端项目会部署到nginx下,可以通过 nginx 进行接口代理location ~ /api/ { proxy_pass http://172.30.1.123:8081; }
方法一,通过 CORS 跨域,可以让后退设置一下
方法二,一般情况前端项目会部署到nginx下,可以通过 nginx 进行接口代理