Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proxy Error 502 : The proxy server received an invalid response from an upstream server

We are building a mass mailing sending application in Java. Mail is being send by third party SMTP. After sending 400-500 mails tomcat6 service get stopped. Below is the error.

Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /lin/Campaignn.jsp. Reason: Error reading from remote server

Additionally, a 502 Bad Gateway error was encountered while trying to use an ErrorDocument to handle the request.

Apache Server at msizzler.com Port 80

But when we are sending from localhost I did not received any error. It send all the mails. Please help me to sort it out this problem.

like image 423
Ranjeet Ranjan Avatar asked Dec 05 '13 17:12

Ranjeet Ranjan


People also ask

What does this mean the proxy server received an invalid response from an upstream server?

This means that a server (not necessarily a web server) acting as a gateway or proxy and received an invalid response from an upstream (or origin) server. In most cases the problem is not with you computer or your internet connection , it's far more likely that it's the website's server instead.


2 Answers

The HTTP 502 "Bad Gateway" response is generated when Apache web server does not receive a valid HTTP response from the upstream server, which in this case is your Tomcat web application.

Some reasons why this might happen:

  • Tomcat may have crashed
  • The web application did not respond in time and the request from Apache timed out
  • The Tomcat threads are timing out
  • A network device is blocking the request, perhaps as some sort of connection timeout or DoS attack prevention system

If the problem is related to timeout settings, you may be able to resolve it by investigating the following:

  • ProxyTimeout directive of Apache's mod_proxy
  • Connector config of Apache Tomcat
  • Your network device's manual
like image 169
rmeakins Avatar answered Sep 30 '22 14:09

rmeakins


Add this into your httpd.conf file

Timeout 2400 ProxyTimeout 2400 ProxyBadHeader Ignore  
like image 40
Albert Maclang Avatar answered Sep 30 '22 12:09

Albert Maclang