路径路由:React 应用程序的应用程序负载均衡器

2023-12-31

我正在尝试在 AWS 应用程序负载均衡器中创建路径路由。

Example:

  1. apple.mango.com/vaultinstance1端口 80 和 nginx 将其路由到/var/html/reactApp1/build/
  2. apple.mango.com/flowinstance2端口 80 和 nginx 将其路由到/var/html/reactApp2/build/

My configuration look something like this: enter image description here

另外,对于双方来说/var/html/reactApp1/build/ and /var/html/reactApp2/build/,我通常让他们托管说mango.com and apple.com而且它们工作得很好。

问题陈述:当通过路径路由访问应用程序时,例如apple.mango.com/vault or apple.mango.com/flow它到达正确的计算机/根目录,但无法按预期加载站点。

Upon inspecting the blank page, it does not load the node-modules: enter image description here

我哪里错了?


我知道这个问题已经被问了近两年了,但我想我找到了解决方案,所以即使它现在没用,在不久的将来它可能会很重要:

在负载均衡器的规则中,您必须启用一项规则,以允许在尝试搜索 /static/... 时将流量重定向到您的应用程序,因为这是由 React 创建的 bundle.js:

我希望这对你和对我一样有用。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

路径路由:React 应用程序的应用程序负载均衡器 的相关文章

随机推荐