From eca887eadb1e69f38718dc343b514dceb1a1c4be Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Sat, 6 Jun 2026 16:13:12 +0200 Subject: [PATCH] F-12 Cache-Control + F-14 Favicon - F-12: HTML-Antworten erhalten 'Cache-Control: no-store' (Formulare/Session nicht cachebar); statische Assets bleiben cachebar. - F-14: Favicon (bi-globe2 als SVG, Logo-Farbe) inkl. /favicon.ico-Route und in allen Templates -> kein 404-Rauschen mehr. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/main.py | 8 ++++++++ app/static/favicon.svg | 3 +++ app/templates/base.html | 1 + app/templates/error.html | 1 + app/templates/login.html | 1 + 5 files changed, 14 insertions(+) create mode 100644 app/static/favicon.svg diff --git a/app/main.py b/app/main.py index e31806d..df8f5ae 100644 --- a/app/main.py +++ b/app/main.py @@ -57,6 +57,9 @@ def _security_headers(resp): resp.headers['X-Content-Type-Options'] = 'nosniff' resp.headers['Referrer-Policy'] = 'no-referrer' resp.headers.setdefault('Content-Security-Policy', CSP) + # HTML-Seiten (Formulare/Session-Daten) nicht cachen lassen. + if resp.mimetype == 'text/html': + resp.headers['Cache-Control'] = 'no-store' return resp @@ -225,6 +228,11 @@ def index(): return redirect(url_for('dashboard') if 'admin_id' in session else url_for('login')) +@app.route('/favicon.ico') +def favicon(): + return app.send_static_file('favicon.svg') + + @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': diff --git a/app/static/favicon.svg b/app/static/favicon.svg new file mode 100644 index 0000000..1d4716e --- /dev/null +++ b/app/static/favicon.svg @@ -0,0 +1,3 @@ + + + diff --git a/app/templates/base.html b/app/templates/base.html index 3dc9fbe..4b7d1c9 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -4,6 +4,7 @@ {% block title %}DynDNS Manager{% endblock %} + diff --git a/app/templates/error.html b/app/templates/error.html index 17eb49b..872f467 100644 --- a/app/templates/error.html +++ b/app/templates/error.html @@ -4,6 +4,7 @@ {{ code }} — DynDNS Manager + diff --git a/app/templates/login.html b/app/templates/login.html index f5339c1..e2d8b50 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -4,6 +4,7 @@ Login — DynDNS Manager +