Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created September 5, 2011 21:26
Show Gist options
  • Save pamelafox/1195953 to your computer and use it in GitHub Desktop.
Save pamelafox/1195953 to your computer and use it in GitHub Desktop.
CORS on Python/Flask
from flask import request, make_response,
def any_response(data):
ALLOWED = ['http://localhost:8888']
response = make_response(data)
origin = request.headers['Origin']
if origin in ALLOWED:
response.headers['Access-Control-Allow-Origin'] = origin
return response
@simonmelouah
Copy link

New to the concept of access-control-allow-origin, what does data take in? I assume it's the URL requesting?

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