favicon.ico 未找到错误? [英] favicon.ico not found error?
问题描述
我有一个在 Tomcat 上运行的使用 Spring Security 3 的应用程序.我没有为我的网站定义任何图标,但是当我从我的登录页面登录后从我的 IDE somes
运行我的应用程序时,它会将我的页面重定向到:
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
after I login from my login pages it redirects my page to:
http://localhost:8080/favicon.ico
并说:
404 Not Found
这里有一个话题:http://forum.springsource.org/showthread.php?100901-redirect-to-favicon.ico 但是我没有定义 favicon.ico 是否 Spring Security 3 默认需要它(如果是,为什么有时会发生?)
There is a topic here: http://forum.springsource.org/showthread.php?100901-redirect-to-favicon.ico however I didn't define a favicon.ico does Spring Security 3 wants it by default(if yes, why it happens sometimes?)
推荐答案
解释如下:
问题是,当浏览器缓存为空并且有用户进入时,这是发生的事情:
The issue is, when the browser cache is empty and a user comes in, here is what happens:
- 用户请求 URL/".此 URL 已缓存.
- 浏览器向/favicon.ico"发出请求.这个网址变成身份验证后重定向到的新 URL.
- 用户发布登录表单并被重定向到/favicon.ico".
要解决此问题,您需要将/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" />
取自:http://blog.idm.fr/2010/09/spring-security-redirecting-to-faviconico.html
这篇关于favicon.ico 未找到错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!