Skip to content
AnswerWell geo Documentation

Research · 10 min read · Answerwell

HTTP File Scan Policies: AV Malware, DLP, Sandboxing, and File Types

How inline Gateway HTTP policies scan uploads and downloads for malware and sensitive data, and how to control file types and unscannable files.

This page summarises Cloudflare documentation on Cloudflare Gateway inspection of file transfers over HTTP: inline anti-virus (AV) scanning, Data Loss Prevention (DLP), optional file sandboxing, and HTTP policies that block or log specific file types. Gateway acts as a Secure Web Gateway proxy; these controls apply when users upload or download files through traffic you route to Gateway with TLS inspection enabled.

AV scanning: inline malware scan on upload and download

Section titled “AV scanning: inline malware scan on upload and download”

AV scanning means Gateway inspects files as they pass through the proxy and blocks transfers that contain a known malicious payload.

Cloudflare Gateway can scan files for malware as users upload or download them. Anti-virus (AV) scanning runs inline — Gateway inspects files as they pass through the proxy and blocks any file that contains a known malicious payload.

— Cloudflare, AV scanning

In addition to signature-based AV, Gateway can send previously unseen downloads to a sandbox (Enterprise add-on) to look for zero-day behaviour; that path is separate from AV and is covered below under the Quarantine action.

  1. In the Cloudflare dashboard, go to Zero Trust → Traffic policies → Traffic settings.
  2. Under Policy settings, turn on Scan files for malware.
  3. Choose whether to scan during uploads, downloads, or both. You can also block requests that contain non-scannable files.
  4. Optionally turn on Display AV block notification for Cloudflare One Client so users on the Cloudflare One Client see a notification when AV blocks a file.

When malware is blocked, Gateway logs the match as a Block decision in Gateway HTTP logs.

File scan criteria: which uploads and downloads AV inspects

Section titled “File scan criteria: which uploads and downloads AV inspects”

AV scanning does not run on every byte of every response. Gateway applies criteria in order; the first match triggers a scan:

  1. The Content-Disposition HTTP header is set to Attachment.
  2. The byte signature of the request or response body matches a known file type (executables such as .exe, .bat, .dll, .wasm; documents such as .doc, .docx, .pdf, .ppt, .xls; compressed archives such as .7z, .gz, .zip, .rar).
  3. The file name in Content-Disposition contains an extension in those categories.

If none of those match, Gateway falls back to the origin’s Content-Type. It does not scan content it classifies as image, video, or audio; all other content types default to being scanned. See AV scanning — File scan criteria.

Do Not Scan: opt HTTP traffic out of AV scanning

Section titled “Do Not Scan: opt HTTP traffic out of AV scanning”

When AV is enabled globally, every supported file is scanned unless an HTTP policy opts traffic out. Any HTTP selector can use the Do Not Scan action (noscan in the API). Matching traffic is not scanned regardless of file size or type.

Example from the docs: prevent AV on example.com with Hostname matches regex example.com → Do Not Scan. Opt-out respects your global setting (uploads only, downloads only, or both). Full selector list is under HTTP policies — Do Not Scan.

Non-scannable files: size limits, encryption, and fail open vs fail closed

Section titled “Non-scannable files: size limits, encryption, and fail open vs fail closed”

Gateway cannot AV-scan every file. For non-scannable content you choose fail open (allow unscanned) or fail closed (deny the transfer). AV scanning documents these hard limits:

Limit Detail
Size 15 MB (Free), 25 MB (Pay-as-you-go), 100 MB (Enterprise)
Encryption PGP-encrypted files
Archives Password-protected archives; archives with more than three recursion levels; archives with more than 300 files

Certain large or encrypted archives cannot be scanned regardless of type. AV scanning — Non-scannable files and Supported compressed file types list many archive formats Gateway can unpack for AV (ZIP, RAR, 7-Zip, CAB, and others).

HTTP policies for password-protected and unscannable file types

Section titled “HTTP policies for password-protected and unscannable file types”

DLP-oriented HTTP policies can block uploads or downloads whose type is unscannable, using Upload File Types / Download File Types:

  • Password-protected Microsoft Office document
  • Password-protected PDF
  • Password-protected ZIP archive
  • Unscannable ZIP archive

Gateway HTTP policies can now block files that are password-protected, compressed, or otherwise unscannable.

— Cloudflare, Block files that are password-protected, compressed, or otherwise unscannable

Configure these alongside other rules in HTTP policies.

DLP on HTTP traffic: profiles, policies, and supported formats

Section titled “DLP on HTTP traffic: profiles, policies, and supported formats”

Data Loss Prevention (DLP) scans HTTP bodies for sensitive patterns (built-in or custom) after Gateway matches your HTTP policy. Typical flow: define a DLP profile, then create a Gateway HTTP policy with the DLP Profile selector and an action (Allow, Block, or logging via Allow).

You can scan HTTP traffic for sensitive data through Secure Web Gateway policies. To enforce DLP policies, first configure a DLP profile that defines what sensitive data patterns to detect. Then build a Gateway HTTP policy that defines what action to take (allow, block, or log) when Gateway finds matching data.

— Cloudflare, Scan HTTP traffic

DLP reporting and scanning cover text/CSV, Microsoft Office 2007+ (.docx, .xlsx, .pptx), PDF, and ZIP archives containing those types. ZIP nesting is limited to 10 recursive compression levels (Data loss prevention — Formats). Custom document entries for training-style detection support .docx and .txt under 10 MB (Configure detection entries).

Streaming ZIP handling: DLP scans ZIP contents with a streaming handler element-by-element, which removes older per-file size limits inside archives and also improves scanning of Office Open XML files (they use ZIP containers). No configuration change is required (Streaming ZIP file scanning).

Before enforcing blocks, Passive Detection can show sampled sensitive data and whether profiles were Covered, Partly covered, or Not covered — a signal to review policies, not an automatic block list.

Body Phase: scan request body, response body, or both

Section titled “Body Phase: scan request body, response body, or both”

The Body Phase selector limits whether DLP inspects data from the user (Request Body) or to the user (Response Body). Policies without Body Phase scan both.

Request Body: Scans data sent from a user’s machine to an upstream service. This is ideal for monitoring data uploads, form submissions, or other user-initiated data exfiltration attempts.

Response Body: Scans data sent to a user’s machine from an upstream service. Use this to inspect file downloads and website content for sensitive data.

— Cloudflare, Refine DLP Scans with New Body Phase Selector

When combining Body Phase with Download File Types or Upload File Types, use the matching phase (for example, download phase with download file types). A mismatch can prevent the policy from filtering as intended (HTTP policies — Body Phase).

Match count and staged Allow vs Block policies

Section titled “Match count and staged Allow vs Block policies”

Match count sets how many detections must appear in one file or HTTP body before DLP acts; duplicate matches count toward the threshold (Profile settings — Match count). For inline Gateway use, Cloudflare documents pairing Allow policies on Low/Medium confidence profiles with Block on High confidence profiles to log weaker signals while blocking only high-confidence matches (Profile settings — Gateway detections).

Common policies shows examples: Allow to log Financial Information on file-sharing categories before blocking; Block by Upload File Types / Download File Types; and Domain not in list to reduce false positives on trusted destinations.

DLP policy precedence: Gateway filters on first match, then scans the HTTP body. Logs may show an earlier Allow even when a later DLP Block wins (Order of enforcement — DLP policy precedence).

Log fields when DLP matches include DLP Action, matched policy/profile/entry IDs, and DLP Check (REQUEST, RESPONSE, or both) (DLP fields in logs documents the field schema in a Gateway context).

Upload and Download File Types: block installers, disk images, and archives

Section titled “Upload and Download File Types: block installers, disk images, and archives”

Download File Types and Upload File Types read file signatures in the HTTP body. Categories include compressed archives, Office/PDF documents, executables, images, System types (for example Apple Disk Image .dmg), and Unscannable types listed above (HTTP policies — Supported file types).

Expanded controls add:

Type Category Blocking behaviour
.dmg System Blocked at the end of the transfer; the browser may show progress then fail before save
.msix, .appx Executable Large MSIX (>100 MB) may be classified as Unscannable ZIP — also select Unscannable to block comprehensively
.pkg Executable Standard file-type policy

(Expanded File Type Controls)

Upload File Size / Download File Size selectors (MiB) let you block transfers by size (HTTP policies — Download and Upload File Size).

File sandboxing: Quarantine action for unknown downloads

Section titled “File sandboxing: Quarantine action for unknown downloads”

File sandboxing (Enterprise add-on) quarantines previously unseen downloads after they pass AV, runs them in a sandboxed Windows environment, shows an interstitial page, then allows or blocks based on behaviour. Repeat downloads of the same file reuse the prior decision (File sandboxing).

Turn it on under Traffic settings → Open previously unseen files in a sandbox environment, optionally Block requests for files that cannot be scanned. HTTP policies use action Quarantine (quarantine) and Sandbox file types (at least one type required). Supported sandbox types include .exe, Office formats, .pdf, .zip, .rar (HTTP policies — Quarantine).

Sandbox non-scannable limits differ from AV: files larger than 100 MB and PGP-encrypted files (File sandboxing — Non-scannable files).

To verify, create a policy with Host is sandbox.cloudflaredemos.com, Quarantine, ZIP Archive, then download from the Cloudflare Sandbox Test host documented in File sandboxing — Create test policy.

Unsanitized HAR files: DLP profile, block, and sanitizer redirect

Section titled “Unsanitized HAR files: DLP profile, block, and sanitizer redirect”

HTTP Archive (HAR) files often contain cookies, authorization headers, and credentials. The predefined Unsanitized HAR profile detects HAR files that lack Cloudflare’s tamper-evident sanitized marker (Predefined profiles — HTTP Archive (HAR) files).

Gateway now includes a predefined DLP profile called Unsanitized HAR that detects HAR files in HTTP traffic. You can use this profile in a Gateway HTTP policy to either block HAR file uploads entirely or redirect users to a sanitization tool before allowing the upload to proceed.

— Cloudflare, Detect and sanitize HAR files

Policy pattern: DLP Profile in Unsanitized HAR → Block (strict) or Block with Gateway Redirect to https://har-sanitizer.pages.dev/. Sanitized files are not re-flagged unless edited. Logs show Unsanitized vs Sanitized classification.

When capturing HAR for support, Cloudflare warns that HAR can include sensitive data and points to sanitization; Chrome can export sanitized HAR by default (Gathering information — Generate a HAR file, Chrome DevTools Network reference). Support accepts .har among text attachments up to 20 MB and prefers uncompressed HAR rather than ZIP-wrapped exports (Contacting Cloudflare Support — Accepted attachment file formats).

DLP forensic copies: full HTTP requests to Logpush storage

Section titled “DLP forensic copies: full HTTP requests to Logpush storage”

On Enterprise plans, Send DLP forensic copies to storage on Allow or Block HTTP policies sends the complete HTTP request (headers and body) to a Logpush destination. A DLP profile is not required on that policy (Logging options — Send DLP forensic copies, Send forensic copies without DLP profiles). Payloads may contain sensitive data; encryption in transit is TLS only until your destination’s policies apply. Archive payloads are truncated to 100 MB uncompressed per request. Up to four forensic Logpush jobs per account.

Troubleshooting: inconsistent DLP and scan errors

Section titled “Troubleshooting: inconsistent DLP and scan errors”

If DLP finds text but not images or some apps:

  • Turn on OCR in the DLP profile for text inside images.
  • Some apps (for example WhatsApp Web) use WebSockets or encryption Gateway HTTP policies cannot fully inspect.
  • Content must be a supported file type.

See Troubleshoot DLP. For the DLP test scanner, uploads must be ≤10 MB and HAR must be valid JSON (Test scan).

  • Enabling AV or DLP without TLS decryption, so encrypted traffic is not inspectable (Secure WAN traffic — DLP requirements).
  • Using Response Body DLP on pages that merely display example sensitive data, causing false positives — narrow with Body Phase Request Body.
  • Blocking .msix without Unscannable when large installers are misclassified.
  • Expecting Gateway HTTP DLP to cover non-HTTP channels (email outbound DLP and CASB scanning have separate limits in other product docs).
  • Trusting a single log line as the final verdict when an Allow logged before a DLP Block (order of enforcement).
  1. In Traffic settings, confirm Scan files for malware, TLS inspection, and (if needed) Allow enhanced file detection match your design.
  2. Review Gateway HTTP logs for Block decisions and DLP fields after a controlled test upload or download.
  3. Run a sandbox test download via the policy in File sandboxing — Create test policy if you use Quarantine.
  4. Use Passive Detection or Allow-first DLP policies from Common policies before rolling out blocks.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.