AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1172418
Accepted
olivierg
olivierg
Asked: 2025-02-07 22:04:53 +0800 CST2025-02-07 22:04:53 +0800 CST 2025-02-07 22:04:53 +0800 CST

Apache 反向代理:打印后端返回的错误,而不仅仅是“错误 500”

  • 772

我有一个 apache 服务器充当 web 服务的反向代理,其配置如下:

<VirtualHost *:18010>

 SSLEngine on
 ProxyRequests off
 SSLProxyEngine on
 ProxyPass / https://backend.url:4445/
 ProxyPassReverse / https://backend.url:4445/
 SSLVerifyClient require
 SSLVerifyDepth 10
 SSLCACertificateFile ssl/cacerts.pem

</VirtualHost>

运行良好。但是,当“客户端”针对 URL 后面运行的 WebService 运行查询时,如果后端响应错误,则代理仅显示存在错误 500,例如:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
 [email protected] to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>

而当“直接”(不通过代理)查询WebService时,我们可以看到服务器返回的“真实”错误,例如:

Error 500: javax.servlet.ServletException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field &quot;test&quot; &#40;Class iseries.wsbeans.avews10.PrecheckInput&#41;, not marked
 at [Source: com.ibm.ws.webcontainer.srt.SRTInputStream@6bd1f156&#59; line: 1, column: 11] &#40;through reference chain: iseries.wsbeans.avews10.PrecheckPaymentInput[&quot;test&quot;]&#41;

所以我的问题是:是否有一个选项可以添加 apache 配置,以便它返回后端返回的完整错误,而不仅仅是错误 500?

再次感谢问候,

apache-2.4
  • 1 1 个回答
  • 64 Views

1 个回答

  • Voted
  1. Best Answer
    basit raza
    2025-02-12T23:55:00+08:002025-02-12T23:55:00+08:00

    禁用 Apache 的错误页面覆盖以允许将实际错误返回给客户端。

    <VirtualHost *:18010>
        ...
        # Disable Apache's error page override
        ProxyErrorOverride off
    </VirtualHost>
    

    https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyerroroverride

    • 0

相关问题

  • %{REQUEST_FILENAME}.ext 是什么意思?为什么额外的 .ext 结尾?

  • 为什么我的 Apache 能够提供 200 个包含斜杠的 .php 文件?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve