shiro 静态资源文件被拦截的问题原因
shiro 拦截器里配置静态资源不拦截
Map<String, String> map = new LinkedHashMap<>();
// 对于静态资源不验证
map.put("/static/**","anon");
我的static目录下有一个index.html
前提:没有用前端模板
问题:当我在浏览器里输入 localhost:8080/index.html之后,直接跳转到 localhost:8080/login
原因:是在shiro拦截器放行静态资源的路径是 /static/index.html
解决办法一: 在你的配置文件里配置静态资源的路径。
例如:
mvc:
static-path-pattern: /static/**
这样我们访问静态页面的路径就是 localhost:8080/static/index.html.
shiro 就不会拦截了。
解决办法二:
如果不配置上面的内容,直接在shiro 拦截器里配置
map.put("/index.html","anon");
问题解决!!!!!!!!!!!!