node.js - 仅当我使用“/”(不在其他路径中)时,Apache ProxyPass 才加载资源
问题描述
我正在尝试使用 Apache 将 React 加载到另一个端口。我在 Apache Config 文件中使用:
ProxyPass /node http://localhost:3000/
这显示了我的 index.html,但不是我的 React 资源(图像、js ...)(在localhost/node中)
我发现了这个,如果我更改它的工作目录(在localhost/中):
ProxyPass / http://localhost:3000/
但我不想使用我的“/”,因为我想组合两个按时工作的端口,在另一个站点中显示一个站点。
¿如何在localhost/node中正确加载我的端口 3000 ?
先感谢您!!
解决方案
来自 mod_proxy 文档: https ://httpd.apache.org/docs/2.4/mod/mod_proxy.html
添加 ProxyPassReverse 指令和引号:
ProxyPass "/foo" " http://foo.example.com/bar "
ProxyPassReverse "/foo" " http://foo.example.com/bar "
推荐阅读
- c++ - Opus 编码和解码没有错误但值不同
- jenkins - 在多个类中扩展 Jenkins 作业 DSL 代码
- java - 如何使用 apache camel 而不是 xml 记录列表将平面文件中的单个记录转换为一个 xml
- python - df.columns 给出 ValueError: in pyspark
- ios - 如何在平台IOS Nativescript中使用GridLayout codrrect
- angular - 如何在角度 7 上的图标类中放置变量
- mysql - DataGrip MySql 连接超时 - tableplus+cli 都可以立即工作
- java - 当我在假 api 上调用 RestTemplate.exchange() 时出现 NoClassDefFoundError
- azure - Docker 中的 ASP.NET Core 3.0 应用程序无法在 Azure Web App for Container 中启动
- android - 三星 Galaxy S8 上的 RenderScript 性能低下