ProxyPass无法按预期方式运行,无法与React Router重定向

时间:2019-07-04 06:51:38

标签: reactjs apache redirect

我正在使用服务器

  

版本:Apache / 2.4.6(CentOS)

我已经在上面托管了具有自己的路由系统的react应用 在apache config中,我想将/api呼叫路由到相同的另一个端口 服务器,但是每当我像https://servername.com/api这样调用api时,它都会路由我来响应应用程序

我的Apache配置如下

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.html [QSA,L]
</Directory>

LoadModule proxy_http_module /usr/lib64/httpd/modules/mod_proxy_http.so
NameVirtualHost *:80

<VirtualHost *:443>
    ServerName dummy.com
    ---Proxy *---
    Order deny,allow
        Allow from all
    ---/Proxy---
    SSLProtocol TLSv1.2
    SSLCompression Off
    SSLEngine On
    SSLProxyEngine On
    SSLHonorCipherOrder on
    SSLCipherSuite Something+Something+Something+Something+Something+Something+Something+Something+Something+Something+Something+Something+Something+Something
    SSLCertificateFile /etc/httpd/ssl-cert/dummy.com.crt
    SSLCertificateKeyFile /etc/httpd/ssl-cert/dummy.com.key
    SSLCertificateChainFile /etc/httpd/ssl-cert/dummy.chained.crt
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass https://dummy.com/api http://localhost:4004
    ProxyPassReverse https://dummy.com/api http://localhost:4004
</VirtualHost>

0 个答案:

没有答案