ProxyPass或ProxyPassReverse重定向将我的端口添加到流量

时间:2015-04-15 19:26:15

标签: apache redirect url-redirection proxypass maximo

我在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。

1 个答案:

答案 0 :(得分:0)

好吧,我必须通过让它在9451上监听并设置一个命名虚拟主机来调整conf文件。这是更新的代码: `

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>

`

这似乎有效。祝你好运!