502 proxy Error [error reading from remote server]

Saurabh Agrawal picture Saurabh Agrawal · Sep 6, 2016 · Viewed 27.5k times · Source

I'm getting an error message with my https site. when I am working with my http site it working fine on APACHE2 on Ubuntu 14.04.

enter image description here

here is my virtual host config for https site

<VirtualHost _default_:443>
             SSLProxyEngine On
             ProxyRequests Off
             ProxyPreserveHost On
             RequestHeader set Front-End-Https "On"

            servername jenkins.mydomain.com
            Proxypass / https://192.168.0.93:8080/  Keepalive=on
            ProxypassReverse / https://jenkins.mydomain.com/


            SSLEngine on
            SSLCertificateFile      /etc/apache2/ssl/wildcard.crt
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </virtualHost>

please tell me where I am doing mistake.

Answer

Saurabh Agrawal picture Saurabh Agrawal · Sep 12, 2016

I have solved my issue. I had few mistakes in my virtualhost configurations. new virtualhost configurations with ssl is below

    <VirtualHost *:443>
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/wildcard.crt
        ServerAdmin [email protected]
        ProxyRequests Off
        ProxyPreserveHost On
        AllowEncodedSlashes NoDecode

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

        ServerName jenkins.mydomain.com
        ProxyPass / http://192.168.0.93:8080/ nocanon
        ProxyPassReverse / http://jenkins.mydomain.com/
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

</virtualhost>