nginx的配置: 

 把 /api 转到 另一个域名下

#PROXY-START/api
location /api
{
expires 12h;
if ($request_uri ~* "(php|jsp|cgi|asp|aspx)")
{
expires 0;
}
proxy_pass https://www.c3w.com.cn;
proxy_set_header Host https://www.c3w.com.cn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;

#持久化连接相关配置
#proxy_connect_timeout 30s;
#proxy_read_timeout 86400s;
#proxy_send_timeout 30s;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";

add_header X-Cache $upstream_cache_status;


}

#PROXY-END/api

VUE的配置:

// 代理跨域
proxyTable: {
"/api": {
target: "https://www.c3w.cc/api",// 前端的域名
secure: true, //如果是https接口,需要配置这个参数
changeOrigin: true, //如果接口跨域,需要进行这个参数配置
pathRewrite: {
"^/api" : ""
}
}
},