// 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
Share

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

  1. FIX 1Check n8n is running and has memory

    1. 01Run docker ps and docker logs for the n8n container
    2. 02Look for out-of-memory restarts
    3. 03Raise container memory or reduce data per run
    Did this fix it?
  2. FIX 2Fix proxy config

    1. 01Proxy to the n8n port (default 5678)
    2. 02Pass Upgrade and Connection headers for WebSockets
    3. 03Increase proxy_read_timeout
    4. 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 us

Watch n8n Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

Other n8n errors

All 14 n8n errors and fixes →