Content Encoding Error when trying to use GZip on Apache

I'm attempting to enable Gzip on my webserver and also am not doing well. Of course, I need to have now, I've done it prior to yet success is thwarting me.

I have this in my httpd.conf

<Location "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bt/web">
    # Insert filter
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
    # the above regex won't work. You can use the following
    # workaround to get the desired effect:
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \
    \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary
</Location>

And

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css|html|htm)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

mod_deflate is made it possible for.

What am I doing incorrect?

1
2022-06-07 15:17:44
Source Share
Answers: 1

The first concern is that you have the component with a directory site from the documents system

This is from the Apache guidebook:

When to make use of <Location>. Usage <Location> to use instructions to web content that lives outside the filesystem. For web content that stays in the filesystem, usage <Directory> and<Files>. An exemption is <Location />, which is a very easy means to use a configuration to the whole web server.

When I arrangement mod_deflate on Apache I utilize this arrangement:

# --------------------------------------------------------
# Deflate Module Configuration
# --------------------------------------------------------
<IfModule deflate_module>
  # Set the location to webservers root
  <Location />
    # Insert the filters
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

    # Make sure to never zip binaries (ie6 and chrome has issues with this.)
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
  </Location>

    # Enable mod_deflate logging by uncommenting these lines
    #DeflateFilterNote Input instream
    #DeflateFilterNote Output outstream
    #DeflateFilterNote Ratio ratio

    #LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
    #CustomLog logs/deflate_log deflate 
</IfModule>
1
2022-06-07 19:21:17
Source