英文:
Problem with connecting frontend and backend services through internal load balancer
问题
前端和后端服务似乎分别运行正常,但当我尝试在它们之间进行通信时,我不断收到 ERR_NAME_NOT_RESOLVED 错误。
- 服务发现已经连接
- 所有安全组都是开放的
我认为我们的架构与这个非常相似,如果这有帮助的话。
(https://mohamedwaelbenismail.medium.com/microservices-architecture-deployed-on-ecs-fargate-based-cluster-using-cloudformation-878cb6f90571)
-
只有当我们将内部负载均衡器更改为公共负载均衡器,允许互联网流量并允许0.0.0.0/0时,它才能正常工作。
-
健康检查的状态都是 '健康'。
英文:
Frontend and backend service seem to be working fine separately on its own, but when I try to communicate between frontend and backend I keep getting ERR_NAME_NOT_RESOLVED error.
- Service discovery are all connected
- All security groups are open
I think our architecture is very similar to this if that helps.
(https://mohamedwaelbenismail.medium.com/microservices-architecture-deployed-on-ecs-fargate-based-cluster-using-cloudformation-878cb6f90571)
-
It only works if we change the internal load balancer to public load balancer allow internet traffic and allow 0.0.0.0/0.
-
Status of health check are all 'healthy'
答案1
得分: 0
根据你的示意图,你的 React web application
前端永远无法访问到你的后端。你的前端在客户端的浏览器/移动设备上执行。这意味着唯一的方式访问后端是通过 互联网。因此,你的后端不能在内部负载均衡器后面的私有子网中。
你必须重新设计你的应用程序。前端和后端都必须能够从互联网访问,以便你的前端能够查询后端。
英文:
Based on your schematic illustration, your React web application
front end will never be able to reach your backend. Your front end executes on a client side in their browsers/mobiles. This means that the only way to reach backend is through internet. So your backend can't be in a private subnet behind an internal load balancer.
You have to re-architect your application. Both frontend and backund must be accessible from the internet, for your front end to be able to query the backend.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论