[英]How to use an AWS elastic load balancer with React HTML5 page
I have an React-app web site that plays HTML5 video hosted on EC2.我有一个 React-app web 网站,可以播放 EC2 上托管的 HTML5 视频。 I have two instances running and I can view the web page on each of the two instances.
我有两个实例在运行,我可以在这两个实例中的每一个上查看 web 页面。 If I set up an ELB that points to a single instance and use the load balancer's URL, the web page works as well.
如果我设置一个指向单个实例的 ELB 并使用负载均衡器的 URL,则 web 页面也可以正常工作。 However, with both machines in the target group, the page fails about 50% of the time when going through the load balancer's URL.
然而,对于目标组中的两台机器,页面在通过负载均衡器的 URL 时大约有 50% 的时间失败。
This is the error in _ webpack_require_ :这是 _ webpack_require_中的错误:
TypeError: modules[moduleId] is undefined
modules[moduleId]: undefined
modules: (1) […]
modules["./node_modules/@babel/runtime/helpers/arr…dules/@babel/runtime/helpers/arrayWithoutHoles.js(module, exports)
installedModules: {…}
moduleId: "./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"
An inte.net search for an undefined modules[moduleId] looks like it's all over the place.在互联网上搜索未定义的模块 [moduleId] 看起来到处都是。 And I'm not sure I know enough to ask this question properly.
而且我不确定我是否知道足够正确地问这个问题。
It looks like some people use nginx ( https://www.freecodecamp.org/news/production-fullstack-react-express/ ), which presumably means not using the AWS ELB, which I expect is much harder to control than AWS.看起来有些人使用 nginx ( https://www.freecodecamp.org/news/production-fullstack-react-express/ ),这大概意味着不使用 AWS ELB,我预计它比 AWS 更难控制。
Most streaming protocols require session affinity .大多数流媒体协议需要session affinity 。 Try setting up sticky sessions on your load balancer.
尝试在负载均衡器上设置粘性会话。 Here's how to for classic ELB: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html
以下是经典 ELB 的操作方法: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-sticky-sessions.html
Unfortunately that also pins the other traffic as well, but better than 50% failure.不幸的是,这也固定了其他流量,但比 50% 的故障要好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.