官术网_书友最值得收藏!

Optimizing HTTP server responses with GZIP compression

GZIP compression means sending the response to the client from the server in a .gzip format rather than sending a plain response and it’s always a good practice to send compressed responses if a client/browser supports it.

By sending a compressed response we save network bandwidth and download time eventually rendering the page faster. What happens in GZIP compression is the browser sends a request header telling the server it accepts compressed content (.gzip and .deflate) and if the server has the capability to send the response in compressed form then sends it. If the server supports compression then it sets Content-Encoding: gzip as a response header, otherwise it sends a plain response back to the client, which clearly means asking for a compressed response is only a request by the browser and not a demand. We will be using Gorilla’s handlers package to implement it in this recipe.

主站蜘蛛池模板: 汽车| 宜黄县| 保亭| 焦作市| 沾益县| 偃师市| 普兰店市| 固安县| 桓台县| 敦煌市| 磐安县| 大同市| 德庆县| 寻甸| 龙口市| 高雄市| 奎屯市| 平度市| 兴文县| 通渭县| 永清县| 沙湾县| 鄱阳县| 昌吉市| 铜山县| 南江县| 青冈县| 万年县| 旬邑县| 永定县| 保定市| 伊宁市| 塔河县| 红桥区| 封开县| 湘乡市| 汉阴县| 德兴市| 绵竹市| 新营市| 杭锦旗|