3

I've installed Apache 2.4.37 via ppa:ondrej/apache2 and can't make mod_deflate (gzip compression) works. I'm running on Ubuntu 18.04 server.

mod_deflate is enabled in Apache:

sudo apachectl -t -D DUMP_MODULES | grep deflate
deflate_module (shared)

I placed code into .htaccess:

AddOutputFilterByType DEFLATE text/css
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA,NE]

.htaccess is enabled by Apache config (and redirection works).

When I try: curl -I -H 'Accept-Encoding: gzip,deflate' http://myserver/pokus.css

is returned:

HTTP/1.1 302 Found
Date: Thu, 24 Jan 2019 12:20:00 GMT
Server: Apache/2.4.37 (Ubuntu)
Location: https://myserver/pokus.css
Content-Type: text/html; charset=iso-8859-1

So file is returned uncompressed.

I also tried to add deflate command directly into VirtualHost, different command like SetOutputFilter DEFLATE, but without success.

No error message in /var/log/apache2/error.log. Apache is restarted also without errors.

Any idea?

Jan Hana
  • 33
  • 2

0 Answers0