troubleshooting Question

Apache proxy: Error reading status line from remote server"

Avatar of Ludwig Diehl
Ludwig DiehlFlag for Peru asked on
Apache Web Server* Proxy bypass* Reverse proxy
5 Comments1 Solution8079 ViewsLast Modified:
I have recently set up a proxy server using apache. However I randomly receive this message "502 Proxy error : Error reading status line from remote server".
What is supposed to be the proper way to solve this issue?. I mean, I prefer not using fixes like the ones I had to include to getr rid of this error temporally

        SetEnv force-proxy-request-1.0 1
                SetEnv proxy-nokeepalive 1
                SetEnv proxy-initial-not-pooled 1

This is my configuration:

<VirtualHost *:443>
        ServerName subdomain.mydomain.com
        ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
        <Proxy *>
               AddDefaultCharset off
               Order deny,allow
        </Proxy>
        <Proxy balancer://hostingCluster>
               BalancerMember http://server1:80 timeout=10 retry=3 hcmethod=HEAD hcexpr=ok234 hcinterval=10
               BalancerMember http://server2:80 timeout=10 retry=3 hcmethod=HEAD hcexpr=ok234 hcinterval=10
               ProxySet lbmethod=byrequests
               ProxySet stickysession=PHPSESSID

                SetEnv force-proxy-request-1.0 1
                SetEnv proxy-nokeepalive 1
                SetEnv proxy-initial-not-pooled 1

        </Proxy>
        <Location /manager>
                SetHandler balancer-manager
                AuthType Basic
                Require valid-user
                AuthUserFile /var/www/.htpasswd
                AuthName "Authorization Required"
        </Location>
        ProxyPreserveHost On
        SSLProxyEngine On
        ProxyTimeout 1200
        ProxyBadHeader Ignore
        ProxyRequests off
        ProxyVia Off
        ProxyPass /manager !
        ProxyPass / balancer://hostingCluster/
        ProxyPassReverse / balancer://hostingCluster/
        SSLEngine On
        SSLCertificateFile /etc/ssl/certs/mycert.crt
        SSLCertificateKeyFile /etc/ssl/certs/mycert.key
        SSLCertificateChainFile /etc/ssl/certs/mycerCA.crt
        LogLevel info
        ErrorLog /var/log/httpd/error_log
        TransferLog /var/log/httpd/access_log
        ServerSignature Off
        HostnameLookups On
</VirtualHost>

By the way, is there anything you recommend to improve my configuration in terms of security, performance, etc?

Thanks in advance
ASKER CERTIFIED SOLUTION
Ludwig Diehl
Project Manager

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros