Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will mod_gzip compress the cookies

I have a php web application that uses big cookies to store a lot of users data. If I set mod_gzip on the apache server, will it compress only the page content or will it compress the cookies also?

like image 261
Eric Hogue Avatar asked Sep 04 '09 20:09

Eric Hogue


People also ask

Is Brotli better than gzip?

Since Brotli was designed to compress streams on the fly, it is faster at both compressing content on the server and decompressing it in the browser than in gzip. In some cases the overall front-end decompression is up to 64% faster than gzip.

How do I enable compression in Apache?

Enable Compression for ApacheOpen your Apache virtual host file and enable gzip compression entries line by line. For example, to compress HTML, text, XML, CSS, and Javascript content types, add the following line to your virtual host or . htaccess file.

What is gzip compression?

What Is GZIP Compression? GZIP is a compression technology frequently used for transferring data quickly over the internet. “GZIP” refers to a compression method, software used to compress files with this method, and the file format that results from GZIP compression (usually indicated by the file extension . gz).

What is use of gzip?

gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and intended for use by GNU (from where the "g" of gzip is derived).


2 Answers

No, it compresses only the content. Cookies are sent in the headers, which are never compressed.

like image 67
Filip Navara Avatar answered Oct 23 '22 05:10

Filip Navara


The compression will not happen for cookies with mod_gzip, but you can always compress the cookie data yourself if you know that it is going to be big. Compress the data when you create the cookie, and decompress it when you read the cookie. Be sure to verify a signature on the data before decompressing to help avoid DoS attacks against your code.

like image 6
Greg Hewgill Avatar answered Oct 23 '22 07:10

Greg Hewgill