Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

开发环境ok,部署到服务器提示“登录已过期” #92

Closed
WinChance opened this issue Aug 6, 2020 · 7 comments
Closed

开发环境ok,部署到服务器提示“登录已过期” #92

WinChance opened this issue Aug 6, 2020 · 7 comments

Comments

@WinChance
Copy link

目前部署步骤:
1、按历史issues里面的做法,npm run build;
1.1 除了修改配置文件外,前端其他代码并未修改;
image

2、将dist目录下的文件,放在resources文件中,然后打war包到Tomcat部署;
image

3、访问返回如下提示:
{"msg":"登陆已过期,请重新登陆","code":"20011"}

image

请问我哪里不对呢?非常感谢!!

@Heeexy
Copy link
Owner

Heeexy commented Aug 6, 2020

截屏2020-08-06 下午11 40 17

试试放public目录下呢

@WinChance
Copy link
Author

也试过了,不行。不知道是不是prod.env.js或者index.js里的相关路径写得不对了?博主是直接按照目前最新源码部署到Tomcat的吗?谢谢!!

@WinChance
Copy link
Author

好像所有请求都被自定义过滤器拦截了,在本地调试,用Postman请求也是返回“登录已过期”。请指教,谢谢!!
image
image
image

@Heeexy
Copy link
Owner

Heeexy commented Aug 7, 2020

image
ShiroConfiguration里配置下放行登陆接口。 /api/login/auth...这些

@WinChance
Copy link
Author

本地postman把api去掉,就能请求到IDEA运行工程的auth接口,也能访问到服务器的相同接口。但是部署到服务器,服务前端页面,还是报上面的错误,谢谢!
image
image

@Heeexy
Copy link
Owner

Heeexy commented Aug 7, 2020

看下ShiroFilterFactoryBean的配置呢,而且首页地址不需要 /index吧

@Heeexy Heeexy closed this as completed Aug 7, 2020
@WinChance
Copy link
Author

最终在博主的指导下,解决了!!
导致该问题的原因如下:
1、部署方式不同:博主是把vue打包后的文件,放在IDEA的public目录,直接mvn package打jar包,然后服务端java -jar xxx.jar运行;而我是打war,通过Tomcat部署
2、我的Shiro拦截路径,漏了加上虚拟目录;同样,前端pro.env.js也要加上;加上这些后,Postman终于能够请求到数据,但是页面还是不ok;
3、我又尝试将vue的文件放在虚拟目录根路径下,居然就ok了。
总结:虽然歪打正着ok了,但是后面还要继续学习,很多问题没搞懂!!感谢博主!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants