// troubleshooting guide · n8n
n8n 502 Bad Gateway Behind Reverse Proxy
- Status
- Workaround available
- platforms:
- Self-hosted
- updated:
- November 24, 2026
- reports:
- 3
- Method
- how we research
RUNBOOK · n8n/502-bad-gateway2 FIXES
// quick answer
A 502 on self-hosted n8n usually means the proxy cannot reach n8n or n8n is stalled on a heavy run. Check the container is up, memory, and proxy timeouts and WebSocket settings.
Most likely fix: Check n8n is running and has memory
How to fix it
// try these in order, the most common fix is first
FIX 1Check n8n is running and has memory
- 01Run docker ps and docker logs for the n8n container
- 02Look for out-of-memory restarts
- 03Raise container memory or reduce data per run
Did this fix it?FIX 2Fix proxy config
- 01Proxy to the n8n port (default 5678)
- 02Pass Upgrade and Connection headers for WebSockets
- 03Increase proxy_read_timeout
- 04Set WEBHOOK_URL to the public HTTPS URL
Did this fix it?
SANDBOX · n8n RUNS IN YOUR BROWSER
Try it: run the workflow, fix the broken expression, set the schedule
A hands-on n8n-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.
Symptoms
Editor or webhooks return 502 Bad Gateway, especially during large workflow runs or right after publishing a workflow; the server may hang.
Why it happens
- C-01n8n process crashed or restarting from out-of-memory
- C-02Proxy timeout shorter than the workflow run
- C-03Proxy not forwarding WebSocket upgrade headers
- C-04Wrong upstream port or container network
// this guide also covers
- n8n 502 bad gateway
- n8n nginx 502
Still not working?
If n8n keeps failing, you're not alone. See every n8n problem users report or the alternatives people switch to.
Done fighting n8n? Our small team builds your own n8n alternative, or any software you need: web, mobile, games, desktop. Price agreed together.
Talk to usOther n8n errors
- n8n Webhook Not Registered (404 Error)
- n8n Webhook URL Shows localhost
- n8n Out of Memory (JavaScript Heap Out of Memory)
- n8n Connection Lost Error
- n8n Executions Stuck in Queued / Starting Soon
- n8n Google OAuth redirect_uri_mismatch Error
- n8n Schedule Trigger Running at the Wrong Time
- n8n 'Cannot Read Properties of Undefined' Error