Bad Gateway The proxy server received an invalid response from an upstream server

apache-2.4

I am trying to set the webapp using Apache (Server version: Apache/2.4.38 (Unix)) with SSL and Tomcat (Apache Tomcat/8.5.41)

3 tomcat instances are set as str1, str2, str3 with below settings with jvmroute respectively.
Server.xml as:

Connector port="8988" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"              
Connector port="8010" protocol="AJP/1.3" redirectPort="8443"
Engine name="Catalina" defaultHost="localhost" jvmRoute="str1"

In Httpd.conf with SSL module enabled and pointing httpd-ssl.conf

Listen 80
ServerName abcd.example.com:80
RewriteEngine On
RewriteCond %{SERVER_PORT} =80
RewriteRule (.*) https://abcd.example.com/search [R=301,L]

In httpd-ssl.conf

Listen 443
SSLEngine on
ServerName abcd.example.com:443

In Proxy-balancer.conf:

ProxyPass /search balancer://stcluster/search
ProxyPassReverse /search balancer://stcluster/search
<Proxy balancer://stcluster>
    BalancerMember http://localhost:8988 loadfactor=1 route=str1
    BalancerMember http://localhost:8987 loadfactor=1 route=str2
    BalancerMember http://localhost:8986 loadfactor=1 route=str3
    ProxySet lbmethod=bybusyness
    ProxySet stickysession=JSESSIONID|jsessionid
    ProxySet timeout=300
</Proxy>

Best Answer

I was not able to conclude beyond proxy-balancer.conf miss configuration. Not sure what. I copied the configured Apache/2.4.17 and managed to delete the older apr and finally able to solve the purpose for now.