From a47e92f2bccfa249c351ce719738d402a059ea17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20L=C3=B6vdahl?= Date: Thu, 18 Aug 2022 22:54:10 +0300 Subject: [PATCH] Let favicon be cached (#3729) --- esphome/dashboard/dashboard.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/esphome/dashboard/dashboard.py b/esphome/dashboard/dashboard.py index 1fadac968d..ca2767639d 100644 --- a/esphome/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -947,9 +947,12 @@ def make_app(debug=get_bool_env(ENV_DEV)): class StaticFileHandler(tornado.web.StaticFileHandler): def set_extra_headers(self, path): - self.set_header( - "Cache-Control", "no-store, no-cache, must-revalidate, max-age=0" - ) + if "favicon.ico" in path: + self.set_header("Cache-Control", "max-age=84600, public") + else: + self.set_header( + "Cache-Control", "no-store, no-cache, must-revalidate, max-age=0" + ) app_settings = { "debug": debug,