Skip to content

Instantly share code, notes, and snippets.

@raghothams
Forked from pamelafox/views.py
Created August 11, 2013 11:32
Show Gist options
  • Save raghothams/6204462 to your computer and use it in GitHub Desktop.
Save raghothams/6204462 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment