Skip to content

Commit 9ecf9a4

Browse files
committed
fix cache problem
1 parent 7a490c6 commit 9ecf9a4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

web-report/webreport.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ class Handler(http.server.SimpleHTTPRequestHandler):
1111
def __init__(self, *args, **kwargs):
1212
super().__init__(*args, directory=os.getcwd(), **kwargs)
1313

14+
def end_headers(self):
15+
self.send_header("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0")
16+
self.send_header("Pragma", "no-cache")
17+
self.send_header("Expires", "0")
18+
super().end_headers()
19+
1420
def start_server():
1521
with socketserver.TCPServer((HOST, PORT), Handler) as httpd:
1622
print(f"Serving at http://{HOST}:{PORT}")
1723
webbrowser.open_new_tab(f"http://{HOST}:{PORT}")
1824
httpd.serve_forever()
1925

2026
if __name__ == "__main__":
21-
start_server()
27+
start_server()

0 commit comments

Comments
 (0)