我已将Enable HTTP status codes
设置为off
我正在使用cfWheels处理错误,并调用状态代码<cfheader statuscode="404" statustext="HTTP 404 - Page does not exist" />
但我不断收到两条消息。一台由服务器生成,另一台由我创建。
如果删除自定义 header 404状态代码,则会得到200代码,这会产生误导。如果我将其保留在html代码之前显示500 - Internal Server Error
,那么它会使布局困惑,并给出错误的错误代码。
我仅在CF 10服务器上看到此消息,而不是在CF 9服务器上看到此消息。
最佳答案
您可以尝试以下代码:-
<cfcontent reset="true">
<cfheader statuscode="404" statustext="Not Found">
404 page is working as expected. Current time <cfoutput>#now()#</cfoutput>
<cfheader name="Content-Length" value="#getPageContext().getCFOutput().getBuffer().size()#">
另外,请查看您的问题是否与https://bugbase.adobe.com/index.cfm?event=bug&id=3488063有关
关于error-handling - coldfusion 10-自定义处理时隐藏状态码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23315924/