Container & RAM Tuning
Right-Sizing dify-sandbox and Squid ssrf_proxy Containers
Isolate untrusted workflow Python/Node code execution and outbound HTTP tool fetches with strict memory ceilings and timeouts.
280-1,400 MB Sandbox · 140 MB Squid SSRF · Zero Escape
Why ssrf_proxy Is Mandatory in Production
Custom HTTP Request nodes in Dify workflows let users query external URLs. Routing those calls through Squid ssrf_proxy on an internal Docker network blocks access to cloud metadata endpoints (169.254.169.254) and private subnets for just ~140 MB of RAM.
Preventing Sandbox Fork Bombs
Always pair deploy.resources.limits.memory on the sandbox service with SANDBOX_WORKER_TIMEOUT=15..30 so runaway loops terminate before exhausting host memory.
Measured Thresholds & Container Limits
| Container | Role in 9-Container Stack | Recommended Limit |
|---|---|---|
| sandbox | Executes Python3 / NodeJS workflow nodes | 512M (light) / 1,536M (heavy) |
| ssrf_proxy | Squid egress filter blocking LAN/metadata IPs | 256M fixed |
| nginx | TLS/reverse proxy + SSE timeout handling | 192M fixed |