doumian3780 2019-05-27 16:21
浏览 235
已采纳

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.

My Instance Status Checks: Instance Status checks

Below is how I've configured my Application Load Balancer's Target Group: Target groups 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: classic load balancer port

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

  • 写回答

1条回答 默认 最新

  • dryb38654 2019-05-28 15:26
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c