From 0a9714fbe7903bee85fe7947253d85128776ead8 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Sat, 17 May 2025 19:30:26 +0800 Subject: [PATCH] perf: no cache for fronend page --- pkg/api/http/controller/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/api/http/controller/main.py b/pkg/api/http/controller/main.py index 3c8097b8..60882359 100644 --- a/pkg/api/http/controller/main.py +++ b/pkg/api/http/controller/main.py @@ -107,4 +107,8 @@ class HTTPController: elif path.endswith('.txt'): mimetype = 'text/plain' - return await quart.send_from_directory(frontend_path, path, mimetype=mimetype) + response = await quart.send_from_directory(frontend_path, path, mimetype=mimetype) + response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' + response.headers['Pragma'] = 'no-cache' + response.headers['Expires'] = '0' + return response