I added my favicon icon to the root of the resource folder and/or to static folder.

All combinations are not working, I am getting this favicon: https://i.imgur.com/n8KIVRh.png

I tried to add this too: spring.mvc.favicon.enabled=true and I have the same problem.

I changed the favicon.ico to another icon, and it is not working too. If I remove them, the leaf is not appearing too.

Comment From: wilkinsona

By default, the favicon is served for requests matching **/favicon.ico. For example, using HTTPie:

$ http :8080/favicon.ico
HTTP/1.1 200
Accept-Ranges: bytes
Content-Length: 946
Content-Type: image/x-icon
Date: Tue, 14 Aug 2018 16:49:30 GMT
Last-Modified: Tue, 14 Aug 2018 13:14:25 GMT



+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+

The file that is served is found in all of the configured static resource locations, plus the root of the classpath. The latter allows the default icon to be loaded from spring-boot.jar.

The URL that's used to retrieve the favicon depends on the browser you are using and the HTML that's being served. Unfortunately, you haven't provided any information about either of those or even the version of Spring Boot that you are using.

If you would like us to spend some more time trying to help you, please spend some time to provide the information that's requested in the issue template:

Please provide details of the problem, including the version of Spring Boot that you are using. If possible, please provide a test case or sample application that reproduces the problem. This makes it much easier for us to diagnose the problem and to verify that we have fixed it.

In this case, a sample application is required as I cannot reproduce the behaviour that you have described.

Comment From: JavierSegoviaCordoba

I am using the 2.0.4.RELEASE

If I enter to this URL: http://localhost:28001/favicon.ico (28001 is the port of my app), the favicon appears in the middle of the screen, but not in the favicon place.

The favicon is not appearing in Chrome/Firefox

Comment From: wilkinsona

If I enter to this URL: http://localhost:28001/favicon.ico (28001 is the port of my app), the favicon appears in the middle of the screen, but not in the favicon place.

That's the expected behaviour as you've asked your browser to display only the favicon.ico, not an HTML page that uses it. This tells me that everything's working on the server side and the problem lies on the client side. As such, I'm going to close this issue as there's no evidence of a bug in Spring Boot. If you require some further assistance to get this working, I recommend asking a question on Stack Overflow. Your question should include a minimal, complete, and verifiable example so that people can help you.

Comment From: jmussman

Just in case anybody is reading this (I'm looking at it two years later), the problem described by @JavierSegoviaCordoba is not Spring, but the cache in the browser and frequently experienced by developers when they add or change favicon.ico. Once you have visited the site and it locks in on favicon.ico you can't get it to refresh that. Try closing all instances of the browser and then reopening a page on the site.