AWS ELB返回https:// domain_name:8000的404,但可通过public_ip:8000访问
I'm a beginner to deploying web apps on AWS and I believe I have a similar issue to AWS forward port 8000 from elb to port 8000 of EC2 where I have a reactjs frontend and golang api running on aws ec2 and the golang api is running on port 8000 which is accessible via my public_ip:8000 and gaves me messages saying my golang api is operational when I access public_ip:8000. I created the public_ip using Elastic IPs.
I used load balancers to get HTTPS as I have certain features that only work with HTTPS. However when I use my https://domain_name:8000 to send requests to my own API, it says it isn't there and gives me 404 errors when I used an Application Load Balancer.
My domain name uses AWS's Route 53 and AWS nameservers and should have no issues as I am being directed to my normal domain properly. I've added an A record pointing to my load balancer as well.
I've checked the security group used and I have opened up the ports to my IP address.
Below is how I've configured my Application Load Balancer's Target Group:
and for my Listeners I've used HTTP 80, HTTPS 443 and HTTPS 8000 to forward to my target group.
I have tried using classic load balancers as mentioned in the link but they all timeout when I use my domain_name.
Anyone know either a better way to connect or a better way to structure my reactjs frontend and golang backend app on AWS that might need other ports open for api access.
My Classic Load balancer port forwarding config:
EDIT: I've noticed the problem might be my target group as it says that port 8000 is unhealthy and that the request timed out
我是在AWS上部署Web应用程序的初学者,我认为与AWS将端口8000从elb转发到EC2的端口8000 a >我有一个aws ec2上运行的reactjs前端和golang api,并且golang api在端口8000上运行,可通过我的public_ip:8000访问该端口,并给我消息,当我访问public_ip:8000时,我的golang api可以运行。 我使用弹性IP创建了public_ip。 p>
我使用负载平衡器来获取HTTPS,因为我具有某些仅适用于HTTPS的功能。 但是,当我使用 https:// domain_name:8000 将请求发送到我自己的API时,它表示不是 使用Application Load Balancer时出现404错误。 p>
我的域名使用AWS的Route 53和AWS名称服务器,并且没有问题,因为我可以正确地定向到我的普通域。 我还添加了一个指向我的负载均衡器的记录。 p>
我已经检查了所使用的安全组,并已将端口打开到我的IP地址。 p>
下面是我如何配置应用程序负载均衡器的目标组:
我尝试过 使用链接中提到的经典负载均衡器,但是当我使用我的域名时它们全部超时。 p>
任何人都知道连接的更好方法或构造我的reactjs前端和golang后端的更好方法 AWS上可能需要打开其他端口才能访问api的应用程序。 p>
编辑:我注意到问题可能是我的目标组,因为它说的是端口8000 不健康且请求超时 p>
div>
,对于我的侦听器,我使用HTTP 80,HTTPS 443和HTTPS 8000转发到我的目标组。 p>
It was taking forever to figure out the ports and none of the google searches or AWS documentation was helpful so I put my reactjs frontend in one EC2 Instance running on port 80 and my server/golang API into another EC2 instance running on port 80 and then set up the Application Load Balancer to forward to a target group with the frontend if HTTP:80 or HTTPS:443 is called and forward to the target group with the golang API if HTTPS:8000 is called.
Make sure that the instances are in the same availability zone as the load balancer or else it won't work properly and also ensure everything is healthy.