HTTP Request Node Size Constraints#
The HTTP Request Node enforces separate payload size caps on response bodies depending on whether the response is classified as binary (file) or text. These limits are distinct from general workflow variable size settings (e.g., MAX_VARIABLE_SIZE, WORKFLOW_VARIABLE_TRUNCATION_*).
Configuration#
Both limits live in HttpConfig inside api/configs/feature/__init__.py and are injected into every HTTP Request Node instance at graph initialization time via build_http_request_config():
| Env var | Default | Description |
|---|---|---|
HTTP_REQUEST_NODE_MAX_BINARY_SIZE | 10 MB (10 Γ 1024 Γ 1024 B) | Max response size for binary / file responses |
HTTP_REQUEST_NODE_MAX_TEXT_SIZE | 1 MB (1 Γ 1024 Γ 1024 B) | Max response size for text responses |
Two timeout settings in the same HttpConfig class bound how long the node waits for the response to arrive :
| Env var | Default |
|---|---|
HTTP_REQUEST_MAX_CONNECT_TIMEOUT | 10 s |
HTTP_REQUEST_MAX_READ_TIMEOUT | 600 s |
HTTP_REQUEST_MAX_WRITE_TIMEOUT | 600 s |
How Limits Are Wired In#
DifyNodeFactory constructs a single HttpRequestNodeConfig object (via build_http_request_config) and passes it as http_request_config to every HTTP_REQUEST node. All four values β connect/read/write timeouts and both size caps β flow in through this single config object .
Binary vs. Text Classification#
Before applying a limit, the executor classifies the response:
- Binary: responses with known binary MIME types (PDF, ZIP, Office documents, images, etc.) as identified by the
Content-Typeheader; byte-content heuristics are used as a fallback. - Text: all other responses (JSON, HTML, plain text, XML, etc.).
is_file on the Response entity drives which cap is checked.
Enforcement#
Size checking happens in _validate_and_parse_response() within the HTTP Request executor. When the actual response body exceeds the applicable limit, a ResponseSizeError is raised with a human-readable message indicating the response type, the configured maximum, and the actual size β for example:
File size is too large, max size is 10.00 MB, but current size is 15.50 MB.
The validation utility (validate_size() in api/libs/validate_utils.py) is shared across other Dify subsystems for consistent error formatting.
Binary Content in Process Logs#
Binary responses that pass the size check are not decoded to UTF-8 for storage in workflow process logs. Instead, a placeholder string (<binary_content, size=... bytes>) is written, preventing database bloat from large file payloads.
Related Config (Not the Same)#
These limits apply only to HTTP Request Node response payloads. Other size constraints in the same config file serve different purposes:
MAX_VARIABLE_SIZE(200 KB) β general workflow variable size capWORKFLOW_VARIABLE_TRUNCATION_MAX_SIZEβ triggers variable truncation before storageUPLOAD_FILE_SIZE_LIMITβ inbound user file uploads (15 MB)
Key Source Files#
| File | Purpose |
|---|---|
api/configs/feature/__init__.py | HttpConfig β declares HTTP_REQUEST_NODE_MAX_BINARY_SIZE and HTTP_REQUEST_NODE_MAX_TEXT_SIZE |
api/core/workflow/node_factory.py | DifyNodeFactory β calls build_http_request_config(), injecting limits into nodes |
graphon/nodes/http_request/ | HTTP Request Node executor β _validate_and_parse_response(), ResponseSizeError, binary/text classification |
api/libs/validate_utils.py | Shared validate_size() helper used for size enforcement |