Created on
10-21-2019
07:04 AM
Edited on
04-16-2025
11:40 PM
By
Jean-Philippe_P
Description
This article explains how to block file patterns on the Webfilter profile for inbound/outbound traffic.
Scope
FortiGate.
Solution
File Filter allows the Web Filter profile to block files passing through a FortiGate based on file type.
HTTP and FTP File Filtering is configurable in the Web Filter profile.
File Filtering in Web Filter profile is based on file type (file's meta data) only, and not on file size or file content.
Configure a DLP sensor to block files based on size or content, such as SSN numbers, credit card numbers, or regexp.
File filtering only works on proxy mode policies.
Configure the webfilter and enable the File Filter and select the file types are per the requirement and choose the correct protocol on which it is require to block, for which direction.
In the following example, three file filters are used in the Web Filter profile:
To configure a file-type-based web filter in the CLI:
config webfilter profile
edit "webfilter-file-filter"
config file-filter
set status enable
set log enable
set scan-archive-contents enable
config entries
edit "filter1"
set comment "Block PDF files"
set protocol http ftp
set action block
set direction any
set encryption any
set file-type "pdf"
next
edit "filter2"
set comment "Log graphics files"
set protocol http
set action log
set direction incoming
set encryption any
set file-type "jpeg" "png" "gif"
next
edit "filter3"
set comment "Block upload of EXE files"
set protocol ftp
set action block
set direction outgoing
set encryption any
set file-type "exe"
next
end
end
next
end
After configuring file filters in the Web Filter profile, apply it to a firewall policy using the following command:
config firewall policy
edit 1
set name "client-to-internet"
set srcintf "dmz"
set dstintf "wan1"
set srcaddr "all"
set dstaddr "all"
set action accept
set schedule "always"
set service "ALL"
set utm-status enable
set utm-inspection-mode proxy
set logtraffic all
set webfilter profile "webfilter-filefilter"
set profile-protocol-options "protocol"
set ssl-ssh-profile "protocols"
set nat enable
next
end
To configure a file-type-based web filter in the GUI:





In newer version 6.4.1 and above, the File Filter profile has been moved to its own profile:
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.