favicon.rb 401 B

12345678910111213141516
  1. module Shotgun
  2. # Responds to requests for /favicon.ico with a content free 404 and caching
  3. # headers.
  4. class SkipFavicon < Struct.new(:app)
  5. def call(env)
  6. if env['PATH_INFO'] == '/favicon.ico'
  7. [404, {
  8. 'Content-Type' => 'image/png',
  9. 'Cache-Control' => 'public, max-age=100000000000'
  10. }, []]
  11. else
  12. app.call(env)
  13. end
  14. end
  15. end
  16. end