0

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 have already tried using each of these forms 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:

 <FilesMatch \.exe$>
        SetEnv no-gzip 1
    </FilesMatch>

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
BPDESILVA
  • 2,040
  • 5
  • 15
  • 35
Mylon
  • 115
  • 1
  • 2
  • 8
  • By default mod_deflate won't compress the .exe files. You probably have some custom settings that results into that compression. I have mod_deflate enabled on my server and I can download plain .exe files – Bogdan Stoica Jun 16 '19 at 11:02
  • It may have been the "AddType" directive that I was using. – Mylon Jun 16 '19 at 18:56

1 Answers1

-1

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>
Mylon
  • 115
  • 1
  • 2
  • 8