Skip to content

Instantly share code, notes, and snippets.

Forked from rca/
Last active Aug 14, 2019
What would you like to do?
serve static assets for frontend development, with http headers to disable caching
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def 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__':
Copy link

slorber commented Feb 13, 2014

Hello, by chance do you know how to disable the cache from command line?
I'm using this script:

function hostit(){
  echo "Will try to host your directory $pwd at http://localhost:$PORT"
  python -m SimpleHTTPServer $PORT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment