Why am I getting error for apple-touch-icon-precomposed.png

后端 未结 11 1826
梦谈多话
梦谈多话 2020-11-29 16:06

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?

11条回答
  •  囚心锁ツ
    2020-11-29 16:29

    Note that this can happen even when the user has NOT bookmarked the site to their iOS home screen - for example, any time you open a page using Chrome for iOS, it does a GET "/apple-touch-icon-precomposed.png".

    I've handled this and other non-HTML 404 requests in my ApplicationController as follows:

    respond_to do |format|
      format.html { render :template => "error_404", :layout => "errors", :status => 404 }
      format.all { render :nothing => true, :status => 404 }
    end
    

    The format.all response takes care of images such as this PNG file (which does not exist for my site).

提交回复
热议问题