Reputation: 1004
So I'm having this little issue that is starting to really bother me.
My Rails app is on Heroku and is plugged to Bugsnag that tells me that some browser tries to access /favicon.ico
. Unfortunately, my favicon is not under /favicon.ico
as I specify on my HTML:
%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/ico' }
%link{ href: asset_path('favicon.png'), rel: 'apple-touch-icon' }
And as I am using asset_sync with S3, the href generated for the favicon links to S3 and not to /favicon.ico
or favicon.png
So I would like to make /favicon.ico
accessible for those browsers that do not understand HTML.
Here is what I tried in vain:
favicon.ico
file in public folder on Heroku (by running heroku run bash
and wget a favicon.ico)/favicon.ico
and render the image via controller.That seems simple but I can't figure out how to do it!
Upvotes: 4
Views: 671
Reputation: 19398
try to add shortcut to rel attribute
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/ico' }
It could help to maintain versions of IE earlier than 9 https://mathiasbynens.be/notes/rel-shortcut-icon
Upvotes: 1