阿帕奇:摆脱在标题列表保持活动进入 [英] Apache: Get rid of Keep-Alive entry in the headers list

查看:161
本文介绍了阿帕奇:摆脱在标题列表保持活动进入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用LAMP(Linux操作系统,Apache,MySQL和PHP)服务器。

目前的服务器发送与下一个标题列表的响应。我想,以消除安全原因保持活动条目,有标题列表离不开它。是否有可能prevent发送的标题列表中保持活动的条目?

当前响应头:

 缓存控制私人,无缓存,无店铺,必重新验证,检查后= 0,pre-检查= 0
连接保持
内容编码的gzip
内容类型text / html;字符集= UTF-8
日期星期四,2014年3月13日1时43分49秒GMT
过期星期四,2014年3月13日1时43分49秒GMT
保持活动超时= 5,最大值= 200
最后一次修改星期四,2014年3月13日1时43分49秒GMT
杂无缓存
阿帕奇服务器
传输编码分块
有所不同的Accept-Encoding
的X DNS- prefetch控制关闭
X框,选择SAMEORIGIN

响应头我反而喜欢:

 缓存控制私人,无缓存,无店铺,必重新验证,检查后= 0,pre-检查= 0
连接保持
内容编码的gzip
内容类型text / html;字符集= UTF-8
日期星期四,2014年3月13日1时43分49秒GMT
过期星期四,2014年3月13日1时43分49秒GMT
最后一次修改星期四,2014年3月13日1时43分49秒GMT
杂无缓存
阿帕奇服务器
传输编码分块
有所不同的Accept-Encoding
的X DNS- prefetch控制关闭
X框,选择SAMEORIGIN


解决方案

 是否有可能prevent发送的标题列表中保持活动的条目?

据我所知,没有。 保持活动 头是沟通的需要对客户端的持久连接。因此,摆脱头摆脱了客户端与放大器之间的沟通的主要形式的;服务器

这就是说,你的可能的能够得到它未设置使用取消设置在Apache配置或的.htaccess 为<一个href=\"http://www.shanison.com/2012/07/05/unset-apache-response-header-protect-your-server-information/\"相对=nofollow>此处解释。我要强调的如预期在一些Apache版本可能的,因为我有指令不行为。不过,假设诚信,首先要确保标题模块已启用。在Ubuntu 12.04,你会做这样的:

 须藤a2enmod头

然后添加到您的Apache配置或的.htaccess

 &LT; IfModule mod_headers.c&GT;
  头取消设置保持活动
&LT; / IfModule&GT;

现在重新启动Apache:

  sudo的服务重新启动的Apache2

头指令的更多细节在这里

I'm using LAMP (Linux, Apache, MySQL, PHP) server.

Currently the server sends the response with next Headers list. I want to eliminate Keep-Alive entry for security reasons, to have Headers list without it. Is it possible to prevent sending the Keep-Alive entry in the Headers list?

Current Response Headers:

Cache-Control   private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0
Connection  Keep-Alive
Content-Encoding    gzip
Content-Type    text/html; charset=UTF-8
Date    Thu, 13 Mar 2014 01:43:49 GMT
Expires Thu, 13 Mar 2014 01:43:49 GMT
Keep-Alive  timeout=5, max=200
Last-Modified   Thu, 13 Mar 2014 01:43:49 GMT
Pragma  no-cache
Server  Apache
Transfer-Encoding   chunked
Vary    Accept-Encoding
X-DNS-Prefetch-Control  off
X-Frame-Options sameorigin

Response Headers I Would Like Instead:

Cache-Control   private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0
Connection  Keep-Alive
Content-Encoding    gzip
Content-Type    text/html; charset=UTF-8
Date    Thu, 13 Mar 2014 01:43:49 GMT
Expires Thu, 13 Mar 2014 01:43:49 GMT
Last-Modified   Thu, 13 Mar 2014 01:43:49 GMT
Pragma  no-cache
Server  Apache
Transfer-Encoding   chunked
Vary    Accept-Encoding
X-DNS-Prefetch-Control  off
X-Frame-Options sameorigin

解决方案

Is it possible to prevent sending the Keep-Alive entry in the Headers list?

To my knowledge, no. The whole purpose of the Keep-Alive header is to communicate the need for a persistent connection to the client. So getting rid of the headers gets rid of the main form of communication between the client & the server.

That said, you might be able to get it unset by using unset in your Apache config or .htaccess as explained here. I emphasize might since I have had header directives not behave as expected in some versions of Apache. But assuming good faith, first be sure the headers module is enabled. In Ubuntu 12.04 you would do this:

sudo a2enmod headers

And then add this to your Apache config or .htaccess:

<IfModule mod_headers.c>
  Header unset Keep-Alive
</IfModule>

Now restart Apache:

sudo service apache2 restart

More details on the header directive are here.

这篇关于阿帕奇:摆脱在标题列表保持活动进入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆