Search code examples
node.jsamazon-web-servicesamazon-ecs

Localhost to EC2, GET request works but POST request not working AWS


I created a node js app with an express server, after that, I dockerize it and deployed it on AWS ECS, one EC2 instance is also running with good health and in the security group, all traffic is allowed in inbound rules. I have one issue I am sending requests from the frontend to the backend only the GET request works but when I am trying a POST request it didn't work. Below is a screenshot of the Axios error I got when I POST the request -: enter image description here

I also added a CORS header in the node js backend app -: enter image description here

Where is the issue can someone guide me? Thanks


Solution

  • This doesn’t look like EC2 issue but mostly your code.

    Please have a look at this: Axios sending network error while status is 200 ok