Skip to content

Instantly share code, notes, and snippets.

@redbo
Created January 9, 2014 16:54
Show Gist options
  • Save redbo/8337630 to your computer and use it in GitHub Desktop.
Save redbo/8337630 to your computer and use it in GitHub Desktop.
@app.route('/<path:path>', methods=['OPTIONS'])
def allow_cors(path):
resp = current_app.make_default_options_response()
resp.headers['Access-Control-Allow-Origin'] = request.headers.get('Origin')
resp.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT'
resp.headers['Access-Control-Max-Age'] = '21600'
resp.headers['Access-Control-Allow-Credentials'] = 'true'
return resp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment