Search code examples
apachehttp-redirectproxypassmaximo

ProxyPass or ProxyPassReverse redirect is adding my port to traffic


I have a virtual host in Apache that is giving me the fits. I am trying to point a secure external URL to a Maximo Java Virtual machine within our network via Apache. Here is my virtual host from the conf file.

   <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>

The results are, I can go to When I go to : https://maximolink.mydomain.com/maximo/

Some traffic begins to pass between the servers (images, html), but eventually the file paths begin to request and pass as https://maximolink.mydomain.com:9451/maximo/-- I am not sure how to stop the 9451 from being attached to the URL during the passing of the traffic.


Solution

  • Okay I had to adjust the conf file by having it listen on 9451 and set a named virtual host. Here is the updated code: `

    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>
    

    `

    This seems to work. Good Luck!