Stylianos Nikas
Stylianos Nikas

Reputation: 83

blocked by CORS policy AWS 2 processes in one container python flask-cors

I have 2 processes running in 1 Docker container. A frontend and a backend. While the docker container is running properly in my computer, when deploying in aws ecs I get the following error:

Access to XMLHttpRequest at 'http://localhost:5001/list-pdfs' from origin https:awsxxxxxxxxxxx has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local.

At the moment the CORS in my app.py looks like this

CORS(app, resources={r"/*": {"origins": "*"}})
app.config['CORS_HEADERS'] = 'Content-Type'
.
.
.
if __name__ == "__main__":
    app.run(host='0.0.0.0', port=5001, debug=True)

Has anyone else run in this issue and how you fixed that?

I have followed recomendations from other users without successrunning-into-issues-with-cors-with-flask

python-flask-cors-issue with no success.

I have tried Cors with and without specifing origin as well as reading in enviroment variable for the origin.

Upvotes: 0

Views: 72

Answers (0)

Related Questions