7 Replies Latest reply on Apr 11, 2011 2:50 AM by wuschelz

    JBoss & Apache mod_proxy Proxy Error 502

    wuschelz

      We encounter a strange Problem with one of our applications.

       

      The application is deployed on our JBoss and all the requests are coming from Apache via ProxyPass:

       

          ProxyPass /someuri1/ http://:8180/someuri1/     
          ProxyPassReverse /someuri1/  http://:8180/someuri1/     
      
          ProxyPass /someuri2/ http://:8180/someuri1/     
          ProxyPassReverse /someuri2/  http://:8180/someuri1/
      

       

      The Connector of JBoss looks like this (Note: we use Binding Services so its configured as 8080 but replaced by 8180 with binding manager):

       

         

      Connector port="8080" address="${jboss.bind.address}

        maxThreads="250" maxHttpHeaderSize="8192"

           

      emptySessionPath="false" debug="3" protocol="HTTP/1.1"

           

      enableLookups="false" redirectPort="8443" acceptCount="100"

           

      connectionTimeout="20000" disableUploadTimeout="true" />

       

      Now the problem comes:

      When we use Internet Explorer 6 or 7 and connect to Port 80 (Apache) we can log in to the application and when we click around (use another .do) we encounter a Proxy Error 502.

      When we use Internet Explorer 6 & 7 and connect to Port 8180 (Jboss direct) we can use the application without encountering any problems.

       

      With apache log turned on the response header and request header in logfiles i can see, that the request header sent form internet explorer ends up in apache with a 502.

       

      Are there any best practice settings for JBoss and Apache mod_proxy? I didn't found something only the settings we end up now.

       

      Are there special settings in JBoss and Apache for preserving Cookies and Authorization Headers?

       

      Regards

      wuschelz

        • 1. Re: JBoss & Apache mod_proxy Proxy Error 502
          mahnsc

          Can you post the full text of the mod_proxy error from the apache log?  Also, is this a mod_proxy_http configuration or a mod_proxy_balancer configuration?


          • 2. Re: JBoss & Apache mod_proxy Proxy Error 502
            cullendw

            we experienced something vaguely similar. We got around it using port rerouting : try reroute port 8180 to port 80. In our case, the pages returned referenced port 8080, but we connect to the reverse proxy on port 80 which caused issues. The port reroute (on Linux) did the trick. As mentioned by the previous reply, please can you supply both the log files.

            • 3. Re: JBoss & Apache mod_proxy Proxy Error 502
              mahnsc

              I was going to suggest setting a proxyPort value of 80 in the container but without really knowing what the actual error is, it's just a guess (and maybe a bad guess!)

              • 4. Re: JBoss & Apache mod_proxy Proxy Error 502
                cullendw

                If the apache server is binding to a different IP to the jboss server, then setting jboss to use port 80 may work. The problem comes if the apache server and jboss server on binding to the same IP, then you would get a port conflict. The port rerouting would then be a way of getting around that :

                 

                /sbin/iptables -t nat -I PREROUTING -p tcp --dport 8180 -j REDIRECT --to-port 80

                 

                you need to execute it as root.

                 

                However, I feel that both these solutions are potentially solving the symptom and not the underlying cause.

                • 5. Re: JBoss & Apache mod_proxy Proxy Error 502
                  wuschelz

                  Thanks for all the answers and sorry for not answering. I had to find my password again.

                   

                  The sitation goes wired more and more. First i enabled dumpio in apache to see wich requests are sent and wich response go through the wire:

                   

                  when connecting to apache and make a ProxyPass it ends up with (i obfuscated IPs and URL):

                   

                  [Wed May 05 15:03:13 2010] [error] [client 10.99.99.99] (20014)Internal error: proxy: error reading status line from remote server 10.99.99.99, referer: http://someurl/someURI/timeRecording.do 

                   

                  The same with 8180 works fine.

                   

                  When i change ProxyPass to AJP, i get a Bad Request, so i assume that jboss is answering wrong.

                  I tried to dump out all the tomcat requests in log4j for class org.jboss.web.tc5.tomcat in trace level but didn't succeed.

                   

                  Is it possible to see wich http requests or responses are sent by jboss? So perhaps i will find my error there.

                   

                  The idea about the iptables is very good. We us snoop instead but i think the result will be the same. When i good it i will post status.

                   

                  Regards

                  wuschelz

                  • 6. Re: JBoss & Apache mod_proxy Proxy Error 502
                    mahnsc

                    You could probably get the information you want by setting the apache error log to Debug level, too.  

                     

                    The quickest way to set the connector on your jboss server without making too many drastic changes to your config: make a backup of your log4j.xml then open it up and change the logging level for category: 'org.apache' to DEBUG from INFO.  Save it and within 60 seconds, you'll see DEBUG messages show up in your server.log.  This will give you a lot of messages though.

                    • 7. Re: JBoss & Apache mod_proxy Proxy Error 502
                      wuschelz

                      We have been able to solve the problem.

                       

                      The http connector MaxHTTPHeader was too small. We doubled it and everything is fine.

                       

                      We found this out with wireshark tracing.