Apache 覆盖 500 个 HTTP 状态代码响应

标签 apache http status

我正在使用 Apache 作为代理服务器。当我的 Web 应用程序发送 500 错误代码作为对 AJAX 调用的响应时,apache 显示它自己的默认内部错误消息

<!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,
 you@example.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>

有没有办法避免这种情况,这样错误响应就不会被 apache 服务器变形。

最佳答案

我遇到了类似的问题,我正在使用代码:(PHP)

header("HTTP", true, 500);

代替

header("HTTP/1.0 500 Internal Server Error");

第一个在我的本地 XAMPP 服务器上工作但在某些其他服务器上不工作,切换到 HTTP/1.0 响应而不是在两个服务器上工作。

关于Apache 覆盖 500 个 HTTP 状态代码响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7999232/

相关文章:

http - 如何在 HTTP 重定向上转发 header

magento - 当通过 PayPal 付款时如何阻止 magento 将付款状态设置为 "Completed"

apache - 从 xampp 移动到 apache 2.4.7 后,Laravel 路由返回 404。 mod_rewrite 和 htaccess 或缺少 apache 设置?

validation - 带有 Jersey 实现的 JAX-RS 中 POST 申请的 Bean 验证

windows - 我可以在 Windows 上的 Apache 中使用什么熵源?

http - Golang mux http.FileServer不返回图像

android - 浏览器应用程序的 GCM key (带引荐来源网址)状态不活动

vbscript - VBS Microsoft.XMLHTTP 状态

apache - 如何将我的 Apache .htaccess 重写规则转换为 lighttpd

php - 为什么网站速度会逐渐变慢?