I have created a new rails3 project but I am seeing following logs many times in my server logs. Why I am getting these request and how can I avoid these?
Try to change link from
/apple-touch-icon-precomposed.png
to:
<%=asset_path "apple-touch-icon-precomposed.png" %>
There’s a gem like quiet_assets that will silence these errors in your logs if, like me, you didn’t want to have to add these files to your Rails app:
https://github.com/davidcelis/quiet_safari
I finally solved!! It's a Web Clip feature on Mac Devices. If a user want to add your website in Dock o Desktop it requests this icon.
You may want users to be able to add your web application
or webpage link to the Home screen. These links, represented
by an icon, are called Web Clips. Follow these simple steps
to specify an icon to represent your web application or webpage
on iOS.
more info: https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
how to solve?: Add a icon to solve problem.
If you don't care about the icon looking pretty on all sort of Apple devices, just add
get '/:apple_touch_icon' => redirect('/icon.png'), constraints: { apple_touch_icon: /apple-touch-icon(-\d+x\d+)?(-precomposed)?\.png/ }
to your config/routes.rb
file and some icon.png
to your public
directory. Redirecting to 404.html
instead of icon.png
works too.
Same thing is happening for me. And yes, as @Joao Leme said, it seems it is related to a user bookmarking a site to their device homescreen.
However, I noticed that even though there is an error in the log, it's happening behind the scenes and the user never sees the error. I assume the device makes a request for the touch-icon specific to its resolution (which isn't there) until defaulting to the general apple-touch-icon
or apple-touch-icon-precomposed
, if present, or else generates a small screenshot of the current page.
FWIW, put the icons in the /public directory.
If a user from Safari Web browser (Apple devices) visit your site. The browser tries to fetch the site icon if it is not defined in <head>
in the following order:
To resolve this issue either define an icon for safari web browsers or apple devices. Add something like this to head section of your site:
<link rel="apple-touch-icon" href="/custom_icon.png"/>
If you want to keep <head>
clean then upload the icon to root dir of your site with proper name.
The default icon size is 57px.
You can find more details on iOS developer library.