Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gzip compress dynamic content with symfony2

Tags:

gzip

symfony

Is it easy/possible to tell symfony2 to respect the "Accept-Encoding" header sent by web browsers and (if possible) gzip-compress rendered content in the response?

Based on http://developer.yahoo.com/performance/rules.html#gzip it seems like a good idea.

like image 778
Adam Monsen Avatar asked Dec 13 '25 15:12

Adam Monsen


1 Answers

If you are using Apache httpd, then it is quite easy - Just enable the mod_deflate module in the httpd.conf and add AddOutputFilterByType lines for the different types (more info here: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html). I do not believe that symfony2 can gzip something by itself, as this is normally a job for the web server.

like image 110
Jeppe Mariager-Lam Avatar answered Dec 16 '25 17:12

Jeppe Mariager-Lam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!