dsagzmosl32217092 2010-11-12 17:20
浏览 29
已采纳

当PHP发送408标头时,Firefox不会显示页面

There are some times when I'd like my site to trigger a 408-response (for when various pieces aren't responsive). (PHP 5.3.3 and Apache, both Windows and Linux machines)

I can use the following code and get the expected result in all browsers except Firefox:

<?php
// Access forbidden:
header('HTTP/1.1 408 Request Timeout',true,408);
echo 'hi';exit;

But Firefox just immediately sends the "The connection was reset" page, and Firebug shows it got the 408 message. Is this by design in Firefox, or is there some way around this?

  • 写回答

1条回答 默认 最新

  • dongmu3457 2010-11-12 17:26
    关注

    The 408 response is the server telling the client that the client didn't send all the details for a request within the time that the server was willing to wait, and that the server has forcefully closed the connection.

    So, yes, this is by design in Firefox.

    Edit: Consider using the 503 Service Unavailable temporary error code instead, possibly with a Retry-After header. I've never tested to see if the Retry-After works.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么