TECH / Servers & Websites 3 min read

Fixing apple-touch-icon-precomposed.png 404 Errors in Nginx Logs

Antonio NEMCD Author
Published Aug 20, 2013 · 3 min

Open your Nginx or Apache error.log on almost any site and you will spot dozens of 404 entries requesting apple-touch-icon-precomposed.png and apple-touch-icon.png – even when your HTML never mentions those files anywhere.

Cleaning apple-touch-icon-precomposed.png 404 noise from Nginx logs

It is neither an attack nor a broken link in your theme: Apple’s Safari on iPhone and iPad – plus plenty of bots and messengers – automatically probe your site root looking for a home-screen icon.

Why Browsers Request These Files

When someone pins a website to an iPhone or iPad home screen (or simply opens a tab in Safari), the browser fetches a square touch icon – essentially the mobile counterpart to favicon.ico.

Example apple-touch-icon.png

If your <head> does not declare an explicit icon tag, Safari falls back to probing default filenames at the domain root: apple-touch-icon-precomposed.png, apple-touch-icon.png, and sized variants like apple-touch-icon-180x180.png. The -precomposed suffix originally told older iOS builds (pre-iOS 7) not to add an automatic glossy overlay; Apple deprecated it years ago, yet older clients and crawlers still ask for it.

Fix 1 (Best Practice). Provide One 180×180 PNG Icon

Instead of the ancient 57×57 icon from the early non-Retina iPhone era, Apple’s current standard is a single 180×180 PNG. Place it at /apple-touch-icon.png in your web root and add this line inside <head>:

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">

Modern Safari and mobile browsers immediately read that tag and stop guessing missing filenames.

Fix 2. Silence 404 Log Noise in Nginx

Even with a proper icon in place, legacy crawlers will still request apple-touch-icon-precomposed.png or apple-touch-icon-120x120-precomposed.png. To keep them out of your error.log and access.log, add this location block inside your Nginx server { ... } block:

location ~* ^/apple-touch-icon.*\.png$ {
    log_not_found off;
    access_log off;
}

Many admins add an identical block for favicon.ico as well. Test your config and reload Nginx gracefully:

sudo nginx -t && sudo systemctl reload nginx
Tip: avoid returning a fake 204 No Content or HTML page for missing icon files – using log_not_found off; and access_log off; still returns an honest HTTP 404 to the client while keeping your server logs spotless.

Combining both fixes works best: give iOS visitors a crisp 180×180 icon, and add four lines to Nginx so your error log stays focused on real site issues.

Related posts:

Leave a Comment