1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2026-04-20 15:16:38 +00:00

added cache-control headers to python web server

This commit is contained in:
Steven Hugg
2018-11-29 21:41:55 -05:00
parent c0d9bac039
commit b397406f45
2 changed files with 18 additions and 3 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env python3
import http.server
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
http.server.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
self.send_header("Pragma", "no-cache")
self.send_header("Expires", "0")
if __name__ == '__main__':
http.server.test(HandlerClass=MyHTTPRequestHandler)