Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Revert "Temporarily return 404 for favicons"
Uku Taht1cdffb098e8e
diff --git a/lib/plausible_web/plugs/favicon.ex b/lib/plausible_web/plugs/favicon.exindex ad228286a4..ac9562bf82 100644--- a/lib/plausible_web/plugs/favicon.ex+++ b/lib/plausible_web/plugs/favicon.ex@@ -14,25 +14,22 @@ defmodule PlausibleWeb.Favicon do[favicon_domains: domains]end- def call(conn, _opts) do+ def call(conn, favicon_domains: favicon_domains) docase conn.path_info do- ["favicon", "sources", _source] ->- send_resp(conn, 404, "")+ ["favicon", "sources", source] ->+ clean_source = URI.decode_www_form(source)+ domain = Map.get(favicon_domains, clean_source, clean_source)+ res = HTTPoison.get!("https://icons.duckduckgo.com/ip3/#{domain}.ico")++ conn =+ Enum.filter(res.headers, fn {key, _val} -> key != "Transfer-Encoding" end)+ |> Enum.reduce(conn, fn {key, val}, conn ->+ put_resp_header(conn, key, val)+ end)++ send_resp(conn, 200, res.body)|> halt- # clean_source = URI.decode_www_form(source)- # domain = Map.get(favicon_domains, clean_source, clean_source)- # res = HTTPoison.get!("https://icons.duckduckgo.com/ip3/#{domain}.ico")-- # conn =- # Enum.filter(res.headers, fn {key, _val} -> key != "Transfer-Encoding" end)- # |> Enum.reduce(conn, fn {key, val}, conn ->- # put_resp_header(conn, key, val)- # end)-- # send_resp(conn, 200, res.body)- # |> halt-_ ->connend