-
-
Save dustingetz/5348582 to your computer and use it in GitHub Desktop.
serve static assets for frontend development, with http headers to disable caching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import SimpleHTTPServer | |
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def end_headers(self): | |
self.send_my_headers() | |
SimpleHTTPServer.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__': | |
SimpleHTTPServer.test(HandlerClass=MyHTTPRequestHandler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, by chance do you know how to disable the cache from command line?
I'm using this script: