简体   繁体   English

代理错误 502:代理服务器收到来自上游服务器的无效响应

[英]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.我们正在 Java 中构建群发邮件发送应用程序。邮件由第三方 SMTP 发送。发送 400-500 封邮件后,tomcat6 服务停止。 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.代理服务器无法处理请求 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.此外,在尝试使用 ErrorDocument 处理请求时遇到了 502 Bad Gateway 错误。

Apache Server at msizzler.com Port 80 Apache 服务器位于 msizzler.com 端口 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.请帮我解决这个问题。

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. 当Apache Web服务器未从上游服务器(在本例中为您的Tomcat Web应用程序)接收到有效的HTTP响应时,将生成HTTP 502“Bad Gateway”响应。

Some reasons why this might happen: 可能发生这种情况的一些原因:

  • Tomcat may have crashed Tomcat可能已经崩溃了
  • The web application did not respond in time and the request from Apache timed out Web应用程序没有及时响应,Apache的请求超时
  • The Tomcat threads are timing out Tomcat线程超时
  • A network device is blocking the request, perhaps as some sort of connection timeout or DoS attack prevention system 网络设备阻止请求,可能是某种连接超时或DoS攻击防范系统

If the problem is related to timeout settings, you may be able to resolve it by investigating the following: 如果问题与超时设置有关,您可以通过调查以下内容来解决此问题:

Add this into your httpd.conf file 将其添加到httpd.conf文件中

Timeout 2400
ProxyTimeout 2400
ProxyBadHeader Ignore 

The java application takes too long to respond(maybe due start-up/jvm being cold) thus you get the proxy error. java应用程序需要很长时间才能响应(可能是因为启动/ jvm很冷)因此会出现代理错误。

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.

As Albert Maclang said amending the http timeout configuration may fix the issue. 正如Albert Maclang所说,修改http超时配置可能会解决问题。 I suspect the java application throws a 500+ error thus the apache gateway error too. 我怀疑java应用程序抛出500+错误,因此apache网关错误也是如此。 You should look in the logs. 你应该查看日志。

I had this issue once. 我曾经遇到过这个问题。 It turned out to be database query issue. 原来是数据库查询问题。 After re-create tables and index it has been fixed. 重新创建表和索引后,它已得到修复。

Although it says proxy error, when you look at server log, it shows execute query timeout. 虽然它表示代理错误,但是当您查看服务器日志时,它会显示执行查询超时。 This is what I had before and how I solved it. 这就是我之前所拥有的以及我是如何解决它的。

I had this problem too.我也有这个问题。 I was using apache as a reverse proxy for tomcat, my problem was associated with the return time of the response for "apache" proxy我使用 apache 作为 tomcat 的反向代理,我的问题与“apache”代理响应的返回时间有关

I solved it like this: open the "etc/apache/apache2.conf" and the ssl mod conf file "etc/apache/sites-available/000-default-le-ssl.conf" and add the following lines:我是这样解决的:打开“etc/apache/apache2.conf”和 ssl mod conf 文件“etc/apache/sites-available/000-default-le-ssl.conf”并添加以下行:

Timeout 28800
KeepAlive On

maybe this will help you也许这会帮助你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM