favicon.ico not found error?

后端 未结 2 644
陌清茗
陌清茗 2020-12-29 09:41

I have an application that uses Spring Security 3 runs on Tomcat. I didn\'t define any favicon for my website however when I run my application from my IDE sometimes

相关标签:
2条回答
  • 2020-12-29 10:28

    Here is the explanation:

    The issue is, when the browser cache is empty and a user comes in, here is what happens:

    • the user requests URL "/". This URL is cached.
    • the browser makes a requests to "/favicon.ico". This URL becomes the new URL where to redirect to upon authentication.
    • the user posts the login form and is redirected to "/favicon.ico".

    To fix this, you need to set "/favicon.ico" as being a non-secured resources:

    <intercept-url pattern="/favicon.ico" access="ROLE_ANONYMOUS" />
    

    Taken from: http://blog.idm.fr/2010/09/spring-security-redirecting-to-faviconico.html

    0 讨论(0)
  • 2020-12-29 10:46

    For Grails 3.0.11 & Spring Security Core 3.0.2, add "IS_AUTHENTICATED_ANONYMOUSLY" in application.groovy in the section:

    grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    ...
    ..
    .
    [pattern: '/favicon.ico',      access: ['IS_AUTHENTICATED_ANONYMOUSLY']]
    ]
    
    0 讨论(0)
提交回复
热议问题