Loading…
Loading documentation...
Harden self-hosted Dify, Flowise, and Langflow agent platforms with PostgreSQL storage, generated encryption keys, SSRF defenses, and private proxy networks.
Commands checked on 2026-11-23 with Dify 0.14+, Flowise 2.2+, Langflow 1.1+, PostgreSQL 17, Valkey 8.
Production-grade deployment patterns for agent and RAG orchestration tools (Dify, Flowise, and Langflow) backed by persistent PostgreSQL databases, strong cryptographic encryption keys, tenant isolation, and reverse-proxy HTTPS without exposing admin APIs or SSRF HTTP-fetch nodes to internal LAN ranges.
internal_net; see Tune Valkey, Qdrant, Meilisearch, and MinIO in Docker.Workflow builders encrypt model provider API keys, vector store tokens, and session cookies at rest. Never keep example secrets from upstream compose templates:
SECRET_KEY=$(openssl rand -base64 42)
LANGFLOW_SECRET_KEY=$(python3 -c "from secrets import token_urlsafe; print(token_urlsafe(32))" 2>/dev/null || openssl rand -base64 32)
FLOWISE_SECRETKEY_OVERWRITE=$(openssl rand -hex 32)
Store generated keys in a 0600 .env file outside Git (chmod 600 .env) and back them up safely inside a secrets manager.
Embedded SQLite databases corrupt or stall with SQLITE_BUSY under concurrent workflow executions. Configure Postgres dependencies explicitly for Flowise and Langflow:
services:
postgres:
image: pgvector/pgvector:pg17
restart: unless-stopped
environment:
POSTGRES_USER: workflows
POSTGRES_PASSWORD: ${WORKFLOW_DB_PASS}
POSTGRES_DB: workflows
volumes:
- workflows_pg:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U workflows"]
interval: 5s
timeout: 5s
retries: 10
networks:
- internal_net
langflow:
image: langflowai/langflow:latest
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
- LANGFLOW_DATABASE_URL=postgresql://workflows:${WORKFLOW_DB_PASS}@postgres:5432/workflows
- LANGFLOW_SECRET_KEY=${LANGFLOW_SECRET_KEY}
- LANGFLOW_AUTO_LOGIN=false
- LANGFLOW_SUPERUSER=admin
- LANGFLOW_SUPERUSER_PASSWORD=${LANGFLOW_ADMIN_PASS}
volumes:
- langflow_data:/app/langflow
networks:
- internal_net
- proxy_net
Notice LANGFLOW_AUTO_LOGIN=false: leaving auto-login enabled exposes every saved LLM credential to anyone reaching the URL. Similarly, on Flowise set FLOWISE_USERNAME and FLOWISE_PASSWORD (or place behind Authentik OIDC forward auth).
Workflow builders let agents fetch URLs (WebScraper, HTTP Request tools). On cloud VMs or hybrid networks, block containers from calling link-local cloud metadata (169.254.169.254) or private RFC1918 hosts by configuring Dify's SSRF_PROXY_HTTP_URL / sandbox container (dify-sandbox) or egress firewall drops on DOCKER-USER:
sudo iptables -I DOCKER-USER -d 169.254.169.254/32 -j DROP
Verify database connectivity, authentication gates, and proxy health:
docker compose ps
curl -s -o /dev/null -w "Langflow unauth /api/v1/flows -> %{http_code}\n" https://flow.YOUR_DOMAIN/api/v1/flows
Unauthenticated requests to protected workspace endpoints must return 401 or 403, never 200.
/root/.flowise or PostgreSQL volume) wasn't mapped or POSTGRES_DB pointed to an ephemeral container directory. Check docker inspect mounts before pulling new images.Invalid token / decryption failed after restart. WEBUI_SECRET_KEY / LANGFLOW_SECRET_KEY was dynamically regenerated on boot because it wasn't persisted in .env.AUTO_LOGIN=false + MFA SSO) before exposing them beyond a VPN or IP allowlist.v1.x.y) rather than latest before production upgrades, and dump Postgres before upgrading.Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.