Closed spadavec closed 1 year ago
For the people finding this later, it looks like you need to change the header on the response:
def _add_cors_header(response):
response.headers.add("Access-Control-Allow-Origin", "*")
return response
@app.route('/load_protein', methods=['GET'])
def load_protein():
response = make_response(send_file('./proteins/KRAS.pdb'))
return _add_cors_header(response)
And make sure that the {ext : 'pdb'}
is set as a parameter in the Load stage.
I'm hosting a file locally by a Flask server at a specific endpoint:
When I then try to hit this endpoint:
I'm getting CORS errors and can't load the PDB:
Access to XMLHttpRequest at 'http://127.0.0.1:5000/load_protein' from origin 'http://localhost:1212' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Any idea on how I can load a PDB thats being hosted locally via Flask?