- Newest
- Most votes
- Most comments
Hello.
The front end code itself runs on the browser, so I think you will get an error even if you access it using the Docker container name.
In other words, if you change the part specifying “backend:8080” in the front end to something such as an EC2 Public IP address, you should be able to access the site.
https://stackoverflow.com/questions/77635244/failed-to-load-resource-neterr-name-not-resolved-error
Hello,
Your frontend can't find the backend by name. Try these steps:
-
Replace "backend" in login URL with the actual IP address of your backend container (if it works with IP, it's a DNS issue).
-
Ensure your containers share a network where "backend" resolves to the correct IP.
-
Check if your frontend code expects an IP or hostname, and update the login request accordingly.
Update Security Group: Ensure the security group associated with your EC2 instance allows inbound traffic on the port your backend uses (e.g., port 80 for HTTP or port 443 for HTTPS).
# Allow HTTP traffic
Type: HTTP
Port: 80
Source: 0.0.0.0/0
# Allow HTTPS traffic
Type: HTTPS
Port: 443
Source: 0.0.0.0/0
Thank you for your help.
- Ensure your containers share a network where "backend" resolves to the correct IP : it is the case
- Check if your frontend code expects an IP or hostname, and update the login request accordingly: the code expects an hostname
And I double checked everything, I still have the same issue
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
Thank you !
If I put the EC2 public address, if my container is restarting, the IP will change and I will have to manually change the IP. Is there another way to avoid that ?
For example, if you place EC2 under ALB and use ALB's DNS name, you will be able to access it because the DNS name will not change even if the IP address changes. You can also make it a fixed IP by setting ElastcIP on EC2.
So if my DNS name is alexia-coaching.com you suggest that I use http://alexia-coaching.com instead of backend:8080. Is that right? Just to be sure I understand
Yes, it's correct. I think you can access the backend by doing the following.