Practical HTTP Compression Distilled

1. How it works

The intercourse between browser and web server.

Compression scheme negotiation:

The web client advertises which compression schemes it supports by including a list of tokens in the HTTP request. For Content-Encoding, the list in a field called Accept-Encoding; for Transfer-Encoding, the field is called TE.
If the server supports one or more compression schemes, the outgoing data may be compressed by one or more methods supported by both parties. If this is the case, the server will add a Content-Encoding or Transfer-Encoding field in the HTTP response with the used schemes, separated by commas.

2. Where to Configure and How to Configure

If your architecture is Apache HTTP Server + Tomcat, configure in Apache, if your web server is Tomcat, configure in Tomcat directly, beware that Apache HTTP Server might have better performance as it coded in C.

Tomcat reference configuration:

<Connector port="8080" maxHttpHeaderSize="8192"
        maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
        enableLookups="false" redirectPort="8443" acceptCount="100"
        connectionTimeout="20000" disableUploadTimeout="true"
        compression="on"
  compressionMinSize="2048"
  noCompressionUserAgents="gozilla, traviata"
  compressableMimeType="text/html,text/xml"/>

3. How to Test

We may need to change HTTP Request Header's Accept-Encoding in browser, for instance, you can install Modify-Headers plugin in Firefox to do this job.


Reference:

[1] http://en.wikipedia.org/wiki/HTTP_compression

[2] http://viralpatel.net/blogs/enable-gzip-compression-in-tomcat/


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值