关于nuxt服务端渲染 axios跨域请求每次sessionid都不一样的处理方式:
- axios设置withCredentials为true.
- 提供接口的服务器需设置跨域
corsConfiguration.addAllowedOrigin("");
corsConfiguration.addAllowedHeader("");
corsConfiguration.addAllowedMethod("*");
corsConfiguration.setMaxAge(3600l); //这里是3600,只是因为本程序这里需要long类型参数所以加了一个L
corsConfiguration.setAllowCredentials (true); - 关于withCredentials的解释:https://developer.mozilla.org/zh-CN/docs/Web/API/XMLHttpRequest/withCredentials
- 这里要感谢昆虫大侠的一片文章:https://my.oschina.net/alyouge/blog/1930452?from=singlemessage