preflight.py (463B)
1 def main(request, response): 2 response.headers.set(b"Access-Control-Allow-Origin", b"*") 3 response.headers.set(b"Access-Control-Max-Age", b"0") 4 response.headers.set(b"Timing-Allow-Origin", b"*") 5 # If this script is accessed with the header X-Require-Preflight then the 6 # browser will send a preflight request. Otherwise it won't. 7 if request.method == u'OPTIONS': 8 response.headers.set(b"Access-Control-Allow-Headers", 9 b"X-Require-Preflight")