ProxyPass 和 ProxyPassReverse 重定向正在将我的端口添加到流量中

ProxyPass or ProxyPassReverse redirect is adding my port to traffic

我在 Apache 中有一个虚拟主机,它适合我。我正在尝试通过 Apache 将安全的外部 URL 指向我们网络中的 Maximo Java 虚拟机。 这是 conf 文件中的虚拟主机。

   <VirtualHost 5.5.5.5:443>
    ServerName maximolink.mydomain.com
    SSLProxyEngine On
    SSLEngine on

    # Turn on SSL
    SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM
    # Path to DigiCert Certificate
    SSLCertificateChainFile /etc/httpd/conf/ssl.crt/certs/DigiCertCA.crt
    # Path to gafoc certificate
    SSLCertificateFile /etc/httpd/conf/ssl.crt/certs/star_gafoc_com.crt
    # Path to SSL key generated during creation of CSR
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key/maximolink.mydomain.com.key

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia full
    EnableSendFile On
    EnableMMAP On

    RewriteEngine On

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    # Turn on the proxy
    ProxyPass / https://internalmaximoserver.mydomain.com:9451/
    ProxyPassReverse / https://internalmaximoserver.mydomain.com:9451/

    CustomLog /var/log/httpd/ssl-access.log combined
    ErrorLog /var/log/httpd/ssl-error.log

    <Location />
            #ProxyPassReverse /
            Order allow,deny
            allow from all
    </Location>

</VirtualHost>

结果是,我可以去当我去: https://maximolink.mydomain.com/maximo/

一些流量开始在服务器之间传递(图像,html),但最终文件路径开始请求并传递为 https://maximolink.mydomain.com:9451/maximo/-- 我不确定如何在流量通过期间阻止 9451 连接到 URL。

好吧,我不得不调整 conf 文件,让它监听 9451 并设置一个命名的虚拟主机。这是更新后的代码: `

Listen 9451
NameVirtualHost 5.5.5.5:9451
<VirtualHost 5.5.5.5:443 5.5.5.5:9451>
    ServerName maximolink.mydomain.com
    SSLProxyEngine On
    SSLEngine on

    # Turn on SSL
    SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM
    # Path to DigiCert Certificate
    SSLCertificateChainFile /etc/httpd/conf/ssl.crt/certs/DigiCertCA.crt
    # Path to gafoc certificate
    SSLCertificateFile /etc/httpd/conf/ssl.crt/certs/star_gafoc_com.crt
    # Path to SSL key generated during creation of CSR
    SSLCertificateKeyFile /etc/httpd/conf/ssl.key/maximolink.mydomain.com.key

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia full
    EnableSendFile On
    EnableMMAP On

    RewriteEngine On

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    # Turn on the proxy
    ProxyPass / https://internalmaximoserver.mydomain.com:9451/

    CustomLog /var/log/httpd/ssl-access.log combined
    ErrorLog /var/log/httpd/ssl-error.log

    <Location />
            ProxyPassReverse /
            Order allow,deny
            allow from all
    </Location>

</VirtualHost>

`

这似乎有效。祝你好运!