简体   繁体   English

如何将 AWS 弹性负载均衡器与 React HTML5 页面一起使用

[英]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.

相关问题 AWS Elastic Beanstalk 负载均衡器未显示 SSL 证书 - AWS Elastic Beanstalk load balancer not showing SSL certificate AWS 弹性负载均衡器后面的 Jenkins 实例并启用粘性 - Jenkins instance behind AWS Elastic Load balancer and enable stickiness 如何将流量从 Cloudflare 根域路由到 AWS 弹性负载均衡器? - How to route traffic from the Cloudflare root domain to an AWS elastic load balancer? 如何限制 Elastic Load Balancer 上的请求数 - How do I Restrict no of requests on Elastic Load Balancer 我应该在分布式环境中使用单个 AWS Load Balancer 吗? - Should I use a single AWS Load Balancer in a distributed environment? AWS 负载均衡器和 BlueHost - AWS Load Balancer & BlueHost Elastic Beanstalk 负载均衡器登录 Terraform - Elastic Beanstalk Load Balancer Logging in Terraform 如何在 AWS 负载均衡器响应中禁用 Apache HTTP Header 信息? - How to disable Apache HTTP Header info in AWS Load Balancer Response? 如何将配置文件添加到 AWS 应用程序负载均衡器? - How to add a configuration file to a AWS application load balancer? 如何通过 openvpn 云将域路由到 aws 内部负载均衡器? - How to route domain via openvpn cloud to aws internal load balancer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM