ECS Fargate service with load balancer not working

0

I have been stuck on this for 3 days. I have a fargate service running in ECS. It is running a gunicorn app on port 80. I can see from the logs, the server starts:

[2023-04-04 20:51:39 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1)

I have a load balancer, listening at port 80 with a target group. My issue is I cannot seem to access to load balancer. Get the following:

<!doctype html>
<html lang=en>
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>

I can confirm that:

  1. My load balancer is exposed to the internet.
  2. My security group for ECS has inbound rule to allow traffic from my load balancer.

I must have tried about 15 times. I cannot seem to make it work.

已提問 1 年前檢視次數 658 次
1 個回答
1
已接受的答案

I believe that given that the http "404" error is an application error is not related to load balancer or other network configuration. If you are getting 404 error you are actually reaching the application, however the application do have the web page you are trying to display. My suggestion is to double check your docker image configuration, you are probably having some issue on how you build you image.

To make the debugging faster, you could run the container in your local environment, login into your container and verify that you are getting the same error performing the same API call. For example:

wget http://localhost:80

If you are getting the same error is going to be clear that the issue is within the docker image itself

AWS
已回答 1 年前
profile picture
專家
已審閱 9 個月前
profile pictureAWS
專家
已審閱 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南