| 1 |
# If you have not done so already, please first read SECURITY.md in the root |
| 2 |
# directory of this project or online: |
| 3 |
# https://github.com/blueimp/jQuery-File-Upload/blob/master/SECURITY.md |
| 4 |
# |
| 5 |
# The settings in this file require Apache to support configuration overrides |
| 6 |
# in .htaccess files, which is disabled by default since Apache v2.3.9 and needs |
| 7 |
# to be enabled for the directives in this file to have any effect, see also: |
| 8 |
# https://httpd.apache.org/docs/current/mod/core.html#allowoverride |
| 9 |
# |
| 10 |
# If you have full control over the web server, it is preferrable to define the |
| 11 |
# settings in the Apache configuration (e.g. /etc/apache2/apache2.conf) itself. |
| 12 |
# |
| 13 |
# Some of the directives require the Apache Headers module. If it is not |
| 14 |
# already enabled, please execute the following command and reload Apache: |
| 15 |
# sudo a2enmod headers |
| 16 |
# |
| 17 |
# Please note that the order of directives across configuration files matters, |
| 18 |
# see also: |
| 19 |
# https://httpd.apache.org/docs/current/sections.html#merging |
| 20 |
|
| 21 |
# The following directive matches all files and forces them to be handled as |
| 22 |
# static content, which prevents the server from parsing and executing files |
| 23 |
# that are associated with a dynamic runtime, e.g. PHP files. |
| 24 |
# It also forces their Content-Type header to "application/octet-stream" and |
| 25 |
# adds a "Content-Disposition: attachment" header to force a download dialog, |
| 26 |
# which prevents browsers from interpreting files in the context of the |
| 27 |
# web server, e.g. HTML files containing JavaScript. |
| 28 |
# Lastly it also prevents browsers from MIME-sniffing the Content-Type, |
| 29 |
# preventing them from interpreting a file as a different Content-Type than |
| 30 |
# the one sent by the webserver. |
| 31 |
<FilesMatch ".*"> |
| 32 |
SetHandler default-handler |
| 33 |
ForceType application/octet-stream |
| 34 |
Header set Content-Disposition attachment |
| 35 |
Header set X-Content-Type-Options nosniff |
| 36 |
</FilesMatch> |
| 37 |
|
| 38 |
# The following directive matches known image files and unsets the forced |
| 39 |
# Content-Type so they can be served with their original mime type. |
| 40 |
# It also unsets the Content-Disposition header to allow displaying them |
| 41 |
# inline in the browser. |
| 42 |
<FilesMatch ".+\.(?i:(gif|jpe?g|png))$"> |
| 43 |
ForceType none |
| 44 |
Header unset Content-Disposition |
| 45 |
</FilesMatch> |
| 46 |
|
| 47 |
# Uncomment the following lines to prevent unauthorized download of files: |
| 48 |
#AuthName "Authorization required" |
| 49 |
#AuthType Basic |
| 50 |
#require valid-user |