Skip to content

Connect Frontend and Backend in same task description in ECS, AWS Fargate

0

Issue:Access to XMLHttpRequest at 'http://localhost:3015/calculate' from origin 'http://xx.xx.xx.xxx:3000' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local. directivity.js:10 POST http://localhost:3015/calculate net::ERR_FAILED

I saw a post recently in AWS where If your frontend and backend containers are hosted in the same ECS task, your frontend application can talk to your backend container through localhost.

My local host are specified in my environmental variables in the task definition for the frontend portion of the container.

i am quite stuck on this

1 Answer
0

Hello.

The front-end code actually runs on the browser, so I think you need to specify the back-end's public IP address etc. to access the back-end from the front-end code.
I think it depends on how the application is made, but I think you can access it by specifying the following in code such as front-end JavaScript.

http://backend-public-ip
EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.