'"Invalid Host header" error when access AWS ECS through load balancer

I used AWS ECS to deploy my docker app and after successful deployment I can access to the application with public IP address given without any problem.

But when I created an AWS load balancer for ECS and try to access with load balancer's DNS name I'm getting Invalid Host header.

What is the reason for this ?

My running docker containers,

  • nginx at port 80
  • frontend at port 3000
  • backend at port 5000


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source