From a2d2dac2b914fdf43772f10345a730d99e06975b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:52:13 +0000 Subject: [PATCH] Add cache-busting and Clear-Site-Data headers for sovransystemsos.local browser access Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/0e1cbb58-3e7f-412b-be95-8907caaab6f3 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/server.py | 14 ++++++++++++++ modules/core/caddy.nix | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/app/sovran_systemsos_web/server.py b/app/sovran_systemsos_web/server.py index 6ec1a8d..176f301 100644 --- a/app/sovran_systemsos_web/server.py +++ b/app/sovran_systemsos_web/server.py @@ -23,6 +23,7 @@ from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from fastapi.requests import Request from pydantic import BaseModel +from starlette.middleware.base import BaseHTTPMiddleware from .config import load_config from . import systemctl as sysctl @@ -428,6 +429,19 @@ _BASE_DIR = os.path.dirname(os.path.abspath(__file__)) app = FastAPI(title="Sovran_SystemsOS Hub") + +class NoCacheMiddleware(BaseHTTPMiddleware): + async def dispatch(self, request, call_next): + response = await call_next(request) + response.headers["Cache-Control"] = "no-store, no-cache, must-revalidate, max-age=0" + response.headers["Pragma"] = "no-cache" + response.headers["Expires"] = "0" + response.headers["Clear-Site-Data"] = '"cache", "cookies", "storage"' + return response + + +app.add_middleware(NoCacheMiddleware) + _ICONS_DIR = os.environ.get( "SOVRAN_HUB_ICONS", os.path.join(os.path.dirname(_BASE_DIR), "icons"), diff --git a/modules/core/caddy.nix b/modules/core/caddy.nix index e51a599..d97ede7 100755 --- a/modules/core/caddy.nix +++ b/modules/core/caddy.nix @@ -162,6 +162,12 @@ EOF http://sovransystemsos.local { reverse_proxy localhost:8937 + header { + Clear-Site-Data "\"cache\", \"cookies\", \"storage\"" + Cache-Control "no-store, no-cache, must-revalidate, max-age=0" + Pragma "no-cache" + Expires "0" + } } EOF