Why Do MetaDefender Core Webhook Callbacks Fail with HTTP 413 Request Entity Too Large?

This article applies to MetaDefender ICAP Server version 5.x onwards, deployed on Windows and Linux servers.

  1. Description of the Issue

When MetaDefender Core processes large files — particularly PDF documents with Content Disarm & Reconstruction (CDR) running in analysis mode — the resulting scan-result JSON payload can grow very large. This occurs because CDR enumerates every embedded link, URL, and object found within the file; a single large PDF may yield thousands of entries, producing a JSON response exceeding 1 MB.

MetaDefender Core delivers scan results by sending an HTTP POST request to the webhook endpoint configured on the ICAP Server. The ICAP Server's embedded NGINX instance enforces a maximum request-body size controlled by the ICAP configuration key internal/max_size_upload, which defaults to 1,024 KB. When the JSON payload from Core exceeds this threshold, NGINX rejects the inbound POST with an HTTP 413 Request Entity Too Large response.

As a result, MetaDefender Core never receives a 200 OK acknowledgement and repeatedly retries the webhook delivery, generating a cascade of 413 errors visible in both the NGINX log and the MetaDefender Core application log.

Starting from MetaDefender ICAP Server 5.14.0, the default value of internal/max_size_ upload will be increased to 2 MB. For earlier versions, or if your environment generates payloads larger than 2 MB, the manual configuration steps in Section 3 are required.

  1. Steps to Identify

Follow the steps below to confirm that HTTP 413 errors are the root cause of missing webhook callbacks.

2.1 Check the NGINX Log on the ICAP Server

Log file locations:

  • Windows: C:\Program Files\OPSWAT\Metadefender ICAP Server\nginx\nginx.log
  • Linux: /var/log/mdicapsrv/nginx-mdicapsrv.log

Open the log file and search for lines referencing client intended to send too large body combined with a /webhook/ URI path. This confirms NGINX rejected the request from MetaDefender Core:

NGINX nginx.log — 413 body-size rejection (client = MetaDefender Core)

Copy

The HTTP 413 status code alongside the OPSWAT MetaDefender Core user-agent confirms that Core's webhook POST is being rejected by NGINX due to payload size.

2.2 Check the MetaDefender Core Application Log

Log file locations:

  • Windows: C:\Program Files\OPSWAT\MetaDefender Core\data\logs\Core.log
  • Linux: /var/log/ometascan/ometascan.log

Search for Webhook response failed with status='413'. You will typically see multiple repeated entries for the same data_id as Core retries delivery:

MetaDefender Core application log — repeated 413 webhook retries

Copy

The same data_id appearing across multiple consecutive WARNING lines confirms that Core is retrying the same webhook POST and every attempt is rejected by NGINX.

  1. Steps to Resolve

The correct and persistent fix is to increase the internal/max_size_upload configuration key on the ICAP Server. This key controls the client_max_body_size directive that ICAP writes into the generated nginx.conf at every start-up and configuration reload.

Do NOT manually edit nginx.conf directly. The ICAP Server regenerates that file from an internal template on every restart and configuration change. Any manual edit will be silently overwritten, reverting the limit back to 1 MB.

Configuration key details:

  • Key: internal/max_size_upload
  • Unit: kilobytes (KB)
  • Default: 1024 (1 MB)
  • Valid range: 0 – 102400 (0 = unlimited; maximum 100 MB)
  • Suggested value: 10240 (10 MB)

3.1 Windows

On Windows, the ICAP Server stores its configuration in the Windows Registry. Set the max_size_upload value under the internal key:

  1. Open the Registry Editor (regedit.exe) as Administrator and navigate to: HKEY_LOCAL_MACHINE\Software\OPSWAT\ICAP Server\internal
  2. Create a new String value named max_size_upload and set its data to 10240.

Windows Registry — max_size_upload entry

Copy

Alternatively, apply the change from an elevated PowerShell or Command Prompt:

Copy
  1. Restart the OPSWAT Metadefender ICAP Server Windows service to apply the change:
Copy

After restart, ICAP will regenerate nginx.conf with client_max_body_size 10240K; in the server block. The value persists across future restarts and configuration changes.

3.2 Linux

On Linux, the ICAP Server reads its configuration from /etc/mdicapsrv/mdicapsrv.conf. Add or update the max_size_upload key under the [internal] section:

  1. Open /etc/mdicapsrv/mdicapsrv.conf in a text editor with root privileges:

Linux — open ICAP configuration file

Copy
  1. Add or update the following lines under the [internal] section:

/etc/mdicapsrv/mdicapsrv.conf — updated entry

Copy
  1. Save the file and restart the mdicapsrv service to apply the change:
Copy

After restart, ICAP will regenerate nginx.conf with client_max_body_size 10240K; in the server block.

  1. Steps to Check Functionality

After applying the configuration change, verify end-to-end webhook delivery by re-scanning a large PDF file with CDR in analysis mode or your previous file that triggered the issue.

  1. Submit a large PDF file (one that previously triggered the 413 error) for scanning through the ICAP Server or directly via the MetaDefender Core REST API.
  2. Monitor the MetaDefender Core application log in real time and confirm that no new Webhook response failed entries appear for the test scan's data_id:

MetaDefender Core application log — real-time webhook monitoring

Copy
  1. Check the ICAP NGINX log to confirm that webhook POSTs now return 200 instead of 413:

NGINX nginx.log — successful 200 response after fix

Copy
  1. Verify the scan result was correctly received on the ICAP side by confirming the file disposition (clean / infected / blocked) is reflected in the ICAP Server's scan history or the upstream application's response.

Note that internal/max_size_ upload is a global limit that applies to all common REST endpoints on the ICAP Server, not exclusively to /webhook/ paths. Set the value appropriate to your largest expected payload. Values above 100 MB (102400) are not supported.

If Further Assistance is required, please proceed to create a support case or chat with our support engineer.

VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches