Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created September 5, 2011 21:26
Show Gist options
  • Select an option

  • Save pamelafox/1195953 to your computer and use it in GitHub Desktop.

Select an option

Save pamelafox/1195953 to your computer and use it in GitHub Desktop.

Revisions

  1. pamelafox created this gist Sep 5, 2011.
    9 changes: 9 additions & 0 deletions views.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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