You’re getting this error because you don’t have a favicon.ico
in your public/
directory of your application. Because the file doesn’t exist there, Rails moves on, looking for a route to match against /favicon.ico
in the config/routes.rb
.
You can fix this in one of two ways
- Manually place the
favicon.ico
file in thepublic/
directory of your application. -
Put the
favicon.ico
inapp/assets/images/
and then change your<link ...
tag to useimage_path
<link href="https://stackoverflow.com/questions/15687506/<%= image_path("favicon.ico") %>" rel="shortcut icon" />
This will place the
favicon.ico
inpublic/assets/favicon.ico
, not in the document root.
I suggest sticking with #1 above.
As for why this request is even showing up in your logs, many modern browsers look in the root of the domain for /favicon.ico
to use for bookmarking, or presentation in a tab or the address bar. This is why it’s a good idea to keep the favicon.ico
in the root of your domain, in case a browser decides (for whatever reason) to ignore your <link rel="icon shortcut" ...
tag.