http协议学习笔记(一)

一、

http1.1允许使用压缩传输,使用gzip格式,而且主流的浏览器都能进行解压,一般在web服务器都能进行压缩配置。

web开发中可以通过gzip压缩页面来降低网站的流量,而gzip并不会对cpu造成大量的占用,只是几个百分点而已,但是对于页面却能压缩40%以上,非常划算。

resin服务器具体配置方法:
        修改resin/conf/resin.conf文件,在<web-app>中添加以下配置代码:

<filter filter-name="gzip"
          filter-class="com.caucho.filters.GzipFilter">
   <init>
     <use-vary>true</use-vary>
   </init>
  </filter>

  <filter-mapping filter-name="gzip">
    <url-pattern>
      <exclude-pattern>*.pdf</exclude-pattern>
      <include-pattern>/*</include-pattern>
    </url-pattern>
  </filter-mapping>

猜你喜欢

转载自xiaoshan5634.iteye.com/blog/1143619