如何解决Nginx proxy_pass 不适用于 nuxtServerInit
我使用 nginx 代理设置了 nuxt 项目。当我尝试在第一次加载(服务器端)期间刷新身份验证令牌时,除了 nuxtServerInit 之外,一切正常
商店中的nuxtServerInit 不起作用...
async nuxtServerInit( store,{ req } ) {
const { data } = await this.$axios.post('api/user/refresh',{ token: token } );
}
在项目中的任何地方
async button(){
try {
const { data } = await this.$axios.post('api/user/refresh',{ token: sometoken } );
} catch (error) {
console.log(error);
}
}
在 nginx 配置中
location /api/ {
proxy_pass http://backend:4000/;
}
提前致谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。