为什么 apache 在返回 200 状态代码时会在正文中返回错误消息

为什么 apache 在返回 200 状态代码时会在正文中返回错误消息

我已将 Apache 配置为对使用动词发出的所有请求返回 200 OPTIONS

RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]

Apache 确实返回了状态200 OK,但主体包含一条错误消息:

HTTP/1.1 200 OK
Date: Sun, 22 Mar 2015 16:38:10 GMT
Server: Apache/2.4.10 (Win64) PHP/5.6.3
Content-Length: 492
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</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>

为什么这样?配置不正确吗?

答案1

@Maximus,您必须使用“204-No Content”作为响应代码。

详情请见此处:https://stackoverflow.com/a/32146203/2397394

答案2

类似于软 404,这看起来是一个软 500。我建议检查你的 apache 配置中链接中提到的设置,看看这是否是你的问题。

相关内容