问题遇到的现象和发生背景
vue-cli+springboot部署到linux中tomcat和nginx中时ajax请求返回200 ok(来自磁盘缓存),但是取不到数据。
问题相关代码,请勿粘贴截图
vue代码
getIpAddress(){
axios.get("http://ip-api.com/json?lang=zh-CN").then(ipAddress=>{
return ipAddress;
}).then(ipAddress => {
let apiKey="*************************";
axios.get("/juhe/ip/ipNewV3?ip="+ipAddress.query+"&key="+apiKey).then(location=>{
this.location=location;
}).then(() => {
let apiKey="*********************************";
axios.get("/juhe/simpleWeather/query?city="+this.location.result.City+"&key="+apiKey).then(resp=>{
this.weather=resp.result;
});
})
})
}
nginx配置
location /juhe {
add_header Cache-Control no-store,no-cache,must-revalidate;
proxy_pass https://apis.juhe.cn;
rewrite ^/juhe /;
}