Having `/ favicon.ico` available on Heroku with asset_sync

So, I have this little problem that really starts to bother me.

My Rails application is located on Heroku and is connected to Bugsnag, which tells me that some browsers are trying to access /favicon.ico. Unfortunately, my icon is not under /favicon.ico, as I point out in my HTML:

%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/ico' }
%link{ href: asset_path('favicon.png'), rel: 'apple-touch-icon' }

And since I use asset_sync with S3, the href generated to link favicon to S3, not to /favicon.icoor favicon.pngTherefore, I would like to make it /favicon.icoavailable for those browsers that do not understand HTML.

Here is what I tried in vain:

It seems simple, but I can’t figure out how to do it!

+4
source share
1 answer

try adding a shortcut to the rel attribute

%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/ico' }

This can help support IE versions earlier than 9 https://mathiasbynens.be/notes/rel-shortcut-icon

+1
source

All Articles