Skip to content

Instantly share code, notes, and snippets.

@lg
Created July 19, 2015 20:04
Show Gist options
  • Save lg/fb801ea4b6fb39bec36c to your computer and use it in GitHub Desktop.
Save lg/fb801ea4b6fb39bec36c to your computer and use it in GitHub Desktop.
Creates a CORS HTTP Server
#! /usr/bin/env python2
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)
@lg
Copy link
Author

lg commented Jul 19, 2015

to use: curl https://gist.githubusercontent.com/lg/fb801ea4b6fb39bec36c/raw/7230e00cf10b26dafa72ff0703ee59df1f309f3f/cors_http_server.py | python

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