如何通过Apache服务器与现有配置一起代理其他应用程序请求

时间:2019-08-12 20:29:36

标签: reactjs apache amazon-s3 react-router

以下设置适用于现有的Reactjs应用。我创建了一个额外的类似Reactjs前端。 包含这些静态资源的更早版本的Reactjs应用与API共享相同的来源(未显示其Apache映射)。最新的应用程序还将共享相同的API和相同的主机名/域名,例如subdomain.host.com。

我如何创建其他Apache映射,以映射下面的映射,但仍将它们与下面的映射区分开。如果第一个应用程序具有可路由到后端的subdomain.host.com的公共可用主机名,那么如果选择代理subdomain.host.com/app,配置将如何?

${S3_REACT_URL}是后端网址。

cat > /etc/httpd/conf.d/abc-httpd-includes/https_vhost/proxypass.inc <<EOF
ProxyRequests Off
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyMachineCertificateFile /etc/pki/tls/private/client_crt_rsa.pem

<Proxy *>
    Require all granted
</Proxy>

<LocationMatch "^$" >
  ProxyPreserveHost Off
  ProxyPassMatch "${S3_REACT_URL}/index.html" retry=\${CLOUD_HTTPS_PROXY_RETRY} keepalive=\${CLOUD_HTTPS_PROXY_KEEPALIVE} nocanon
  ProxyPassReverse "${S3_REACT_URL}/index.html"
</LocationMatch>

<LocationMatch "^\/(.+)$" >
  ProxyPreserveHost Off
  ProxyPassMatch "${S3_REACT_URL}/\$1" retry=\${CLOUD_HTTPS_PROXY_RETRY} keepalive=\${CLOUD_HTTPS_PROXY_KEEPALIVE} nocanon
  ProxyPassReverse "${S3_REACT_URL}/\$1"
</LocationMatch>

EOF

非常感谢您的帮助。

0 个答案:

没有答案