Can i gzip-compress all my html content(pages)

后端 未结 6 1839
Happy的楠姐
Happy的楠姐 2021-02-05 21:35

I am trying to find out if there are any principles in defining which pages should be gzip-compressed and to draw a line when to send plain html content.

It would be he

6条回答
  •  野性不改
    2021-02-05 22:12

    Considering there is a huge gain on the size of the HTML data to download when it's gzipped, I don't see why you shouldn't gzip it.

    Maybe it uses a little bit of CPU... But not that much ; and it's really interesting for the client, who has less to download. And it's only a couple of lines in the webserver configuration to activate it.

    (But let your webserver do that : there are modules like mod_deflate for the most used servers)

    As a semi-sidenote : you are talking about compressing HTML content pages... But stop at HTML pages : you can compress JS and CSS too (they are text files, and, so, are generally compressed really well), and it doesn't cost much CPU either.

    Considering the big JS/CSS Frameworks in use nowadays, the gain is probably even more consequent by compressing those than by compressing HTML pages.

提交回复
热议问题