139. Download favicon.ico after successful login in Spring Boot Shiro

 

【Video & Communication Platform】

à SpringBoot Video 

http://study.163.com/course/introduction.htm?courseId=1004329008&utm_campaign=commission&utm_source=400000000155061&utm_medium=share

à  SpringCloud video

http://study.163.com/course/introduction.htm?courseId=1004638001&utm_campaign=commission&utm_source=400000000155061&utm_medium=share

à Spring Boot source code 

https://gitee.com/happyangellxq520/spring-boot

à Spring Boot communication platform 

http://412887952-qq-com.iteye.com/blog/2321532

 

 

Origin of need :

       From the comments of several netizens : the login page will download favicon.icon, and the page will not jump to index.html . What is the reason for this, can anyone tell me. . . The code is exactly the same. The browser used is Google

       After the bloggers have simulated several times locally, there is indeed a situation that will definitely occur. The normal startup login access will not.

 

Reason analysis :

       Basically, most browsers will request the favicon.ico icon file to display in front of the browser's URL address, and this file is protected by shiro . Why is it protected by shiro ? Look at our configuration file:

<!-- authc: All urls must be authenticated before they can be accessed; anon: All urls can be accessed anonymously-->
 filterChainDefinitionMap.put("/**", "authc");

 

       Here /** is used to intercept, authc indicates that all urls must be authenticated before they can be accessed.

 

Solutions:

       After knowing the reason, then it is very easy to solve, just add a filter:

filterChainDefinitionMap.put("/favicon.ico", "anon");

  

Netizens' thoughts:

       Let go of the static path

filterChainDefinitionMap.put("/static/**", "anon");

Video & Communication Platform :

à SpringBoot NetEase Cloud Classroom Video 

http://study.163.com/course/introduction.htm?courseId=1004329008

à Spring Boot交流平台

http://412887952-qq-com.iteye.com/blog/2321532

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326964650&siteId=291194637