如何在 apache httpd.conf 中将任何浏览器设置为不保持活动状态

如何在 apache httpd.conf 中将任何浏览器设置为不保持活动状态

我的 httpd.conf 中对 IE 进行了以下设置:

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

我想将其应用于到达我的服务器的所有请求。

我的 httpd.conf 中与保持活动相关的部分如下所示:

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 5

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 1

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 1

我该怎么做呢?

答案1

如果你想禁用所有浏览器的 HTTP keep-alive,只需KeepAlive全局设置为关闭

BrowserMatch如果没有必要,没有必要浪费资源,但如果您真的想使用 BrowserMatch,只需编写一个匹配任何内容的正则表达式。".*"就是一个很好的例子。

相关内容