Class: EnvStyle::FaviconsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/env_style/favicons_controller.rb

Overview

Serves the (possibly tinted) favicon. Bytes are deterministic, so the response carries a strong ETag and revalidation headers — a promoted deploy re-resolves the environment instead of serving a stale-env icon.

Instance Method Summary collapse

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/env_style/favicons_controller.rb', line 8

def show
  favicon = Favicon.new(root: Rails.root)
  return head :not_found unless favicon.available?

  fresh_when(strong_etag: favicon.etag)
  response.cache_control.replace(no_cache: true, extras: ["must-revalidate"])
  return if performed?

  send_favicon(favicon)
end