1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Problem with mod_deflate - compressing executable file

Discussion in 'Apache' started by powersistem, Jun 15, 2019.

  1. #1
    When trying to download file with .EXE extension in the site, the files are coming as .GZ Environment
    Centos 7 64
    Apache 2.4.6

    Changing the file in /etc/httpd/conf/httpd.conf I've already tried using each of these methods below, however, to no avail (I restarted apache and deleted the browser cache on each attempt):

    1: SetEnvIfNoCase Request_URI .exe$ no-gzip dont-vary

    2: SetEnv no-gzip 1

    3: SetEnv mod_deflate off

    4: SetEnv no-gzip off

    5: In the file /etc/httpd/conf.modules.d/00-base.conf I commented: LoadModule deflate_module modules/mod_deflate.so

    6: I tried to delete the file, but it did not work. /usr/lib64/httpd/modules/mod_deflate.so

    Every help is welcome.
    I've researched a lot, relied several tests with similar solutions, but to no avail.
    I do not know what to try anymore.
     
    powersistem, Jun 15, 2019 IP
  2. RoseHosting

    RoseHosting Well-Known Member

    Messages:
    230
    Likes Received:
    11
    Best Answers:
    11
    Trophy Points:
    138
    #2
    If you removed the deflate_module than no file should be compressed. Make sure that you restart apache every time you modify the configuration.

    The following line should ensure that images and exe files are not compressed:

    SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png|exe)$ no-gzip dont-vary
    Code (markup):
     
    RoseHosting, Jun 16, 2019 IP
  3. powersistem

    powersistem Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    I had done so too, had not worked. I was also restarting apache after every change.

    I was reviewing httpd.conf and when I removed the addtype directive (AddType application / x-gzip .tgz .rar .zip .exe .dll) the EXE file was no longer compressed.
    I had put this because the browser was taking too long to start the download EXE, in addition, RAR file instead of downloading, was being displayed as a binary in the browser.

    So I did the following to solve (I do not know if it was the indicated output, but my knowledge is not enough, I'm new in this area):

    
    <IfModule mod_deflate.c>
    # compress text, html, javascript, css, xml...:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE application/x-httpd-fastphp
    AddOutputFilterByType DEFLATE application/x-httpd-eruby
    SetOutputFilter DEFLATE
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch ^HMSI[E] !no-gzip !gzip-only-text/html
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|zip|bz2|rar|exe|pdf|doc|dll|jpg|sit|mp4|mov|mp3|3gp|webm|rm|avi|ogv)$ no-gzip dont-vary
    <FilesMatch \.exe$>
    ForceType application/exe
    Header set Content-Disposition attachment
    </FilesMatch>
    <FilesMatch \.rar$>
    ForceType application/rar
    Header set Content-Disposition attachment
    </FilesMatch>
    </IfModule>
    
    Code (markup):
     
    powersistem, Jun 16, 2019 IP