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

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.

主站蜘蛛池模板: 秦皇岛市| 分宜县| 乌兰察布市| 孝感市| 桓仁| 山西省| 聊城市| 吐鲁番市| 开平市| 天水市| 凤山县| 香格里拉县| 新化县| 巨鹿县| 德化县| 田阳县| 平陆县| 乡城县| 西华县| 扎兰屯市| 登封市| 青岛市| 崇义县| 福鼎市| 芜湖市| 塔河县| 乌拉特中旗| 光泽县| 横山县| 新乡市| 枣强县| 卢氏县| 汾西县| 三台县| 溧水县| 泽普县| 嫩江县| 凯里市| 三门县| 富宁县| 吉林市|