Skip to content

Instantly share code, notes, and snippets.

@dehora
Created June 17, 2016 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dehora/8d9c346f7036c52f9cc93678d04a867c to your computer and use it in GitHub Desktop.
Save dehora/8d9c346f7036c52f9cc93678d04a867c to your computer and use it in GitHub Desktop.
BaseHTTPServer with cors
#! /usr/bin/env python
from SimpleHTTPServer import SimpleHTTPRequestHandler
import BaseHTTPServer
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
if __name__ == '__main__':
BaseHTTPServer.test(CORSRequestHandler, BaseHTTPServer.HTTPServer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment