RE: Apache mod_autoindex and mod_deflate (gzip). Can't get pages compressed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rainer!

Thanks for your response.

Could you please help a bit more?

Here is my Apache Deflate configured:

	DeflateFilterNote Input instream
	DeflateFilterNote Output outstream
	DeflateFilterNote Ratio ratio
	AddOutputFilterByType DEFLATE text/plain
	AddOutputFilterByType DEFLATE text/html
	AddOutputFilterByType DEFLATE text/css
	AddOutputFilterByType DEFLATE text/javascript
	AddOutputFilterByType DEFLATE text/xml
	AddOutputFilterByType DEFLATE text/php
	AddOutputFilterByType DEFLATE image/x-icon
	AddOutputFilterByType DEFLATE application/javascript
	AddOutputFilterByType DEFLATE application/x-javascript
	AddOutputFilterByType DEFLATE application/xml

And these directives works like charm for html, css, js, files, etc.

I tried to add:

	FilterDeclare	COMPRESS	
	FilterProvider	COMPRESS	DEFLATE "%{Content_Type} = 'text/html'"
	FilterProvider	COMPRESS	DEFLATE "%{Content_Type} = 'text\/html.*$'"
	FilterProvider	COMPRESS	DEFLATE "%{Content_Type} = 'text/plain'"
	FilterProvider	COMPRESS	DEFLATE "%{Content_Type} = 'text/php'"
	FilterChain		COMPRESS	gzip_compression
	FilterProtocol	COMPRESS	DEFLATE change=yes;byteranges=no

But still getting chunked responses. I am sending requests to URI '/' and '/TEST/'. And Content-Type for these addresses are "text/html;charset=UTF-8".

Also, I have no ideas why Content-Type is 'text/html;charset=UTF-8', but not just 'text/html'.

Here is header example from LRT plugin for Chrome:

------------------------------------------------------
[
  {
    "url": "https://domain.dom/";,
    "redirect": false,
    "redirectType": "",
    "statusCode": 200,
    "statusLine": "HTTP/1.1 200 OK",
    "headers": [
      {
        "name": "Date",
        "value": "Mon, 03 Aug 2020 19:18:19 GMT"
      },
      {
        "name": "Server",
        "value": "Apache/2.4"
      },
      {
        "name": "Accept-Ranges",
        "value": "none"
      },
      {
        "name": "Vary",
        "value": "Accept-Encoding,User-Agent"
      },
      {
        "name": "Cache-Control",
        "value": "max-age=86400, private, must-revalidate"
      },
      {
        "name": "X-Permitted-Cross-Domain-Policies",
        "value": "none"
      },
      {
        "name": "X-Content-Type-Options",
        "value": "nosniff"
      },
      {
        "name": "X-XSS-Protection",
        "value": "1; mode=block"
      },
      {
        "name": "X-Frame-Options",
        "value": "deny"
      },
      {
        "name": "Content-Language",
        "value": "en"
      },
      {
        "name": "Keep-Alive",
        "value": "timeout=5, max=95"
      },
      {
        "name": "Connection",
        "value": "Keep-Alive"
      },
      {
        "name": "Transfer-Encoding",
        "value": "chunked"
      },
      {
        "name": "Content-Type",
        "value": "text/html;charset=UTF-8"
      }
    ],
  }
]
------------------------------------------------------

Please advise what could be wrong.

Thanks in advance!

-----Original Message-----
From: Rainer Canavan [mailto:rainer.canavan+httpdusers@xxxxxxxxxx] 
Sent: 03 August 2020 12:41 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  Apache mod_autoindex and mod_deflate (gzip). Can't get pages compressed

On Fri, Jul 31, 2020 at 9:01 PM eika from Ru-Board <eika.at.ruboard@xxxxxxxxx> wrote:
>
> Hi folks!
>
> I come across with issue I can't fix. I have Apache/2.4.43 
> OpenSSL/1.1.1g with mod_autoindex (showing directory listings instead 
> of index.html) and with mod_deflate.
>
> I was able to get content gzipped, but only if they are files with 
> extensions (e.g. .css, .html, etc.) But when I want to get gzipped 
> page coming from mod_autoindex, I can't get it. E.g. 
> https://domain.dom, https://domain.dom/somedir/, 
> https://domain.dom/test/, etc. These URLs comes without Content-encoding: gzip header.
>
> I think that I am not far from the reason why, because I found that 
> directory indexes sent by chunks (transfer-encoding: chunked). But 
> files with extensions came with these headers:

I suspect that you have simply configured mod_gzip to be only active for URLs ending in .html etc, and the transfer-encoding just happens to correlate with that because it's not a local "file" but generated dynamically. You should check the outgoing content-type instead of the URL. We've been using the following for quite some time:

   FilterProvider buffer           BUFFER   "%{CONTENT_TYPE} =~ m|^text/|"
   FilterProvider buffer           BUFFER   "%{CONTENT_TYPE} =~ m|^model/|"
[... more content types ]
   FilterProvider gzip_compression DEFLATE  "%{CONTENT_TYPE} =~ m|^text/|"
   FilterProvider gzip_compression DEFLATE  "%{CONTENT_TYPE} =~ m|^model/|"
[...]
   FilterChain buffer gzip_compression

rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux