Web Development

n8n webhook 524 timeout Cloudflare: Find and fix it

Diagnose an n8n webhook timeout from Cloudflare to the reverse proxy, then choose a safe synchronous or asynchronous fix for the request flow and error 524.

n8n webhook timeout troubleshooting on monitor
n8n webhook timeout troubleshooting on monitor

A Cloudflare 524 means Cloudflare reached the origin but received no HTTP response within its allowed wait. An n8n webhook may keep running after Cloudflare closes the connection. Trace the request through Cloudflare, the reverse proxy, n8n, and the workflow before changing any timeout.

What you observe

A Cloudflare 524 usually means the production webhook did not answer the caller in time. n8n may have accepted the request and may still be running the workflow. Check the execution record before deciding that n8n failed.

A long-running n8n Cloud webhook has reportedly ended with a 524 or 504 after about 100 seconds. In that deployment, Cloudflare enforced the connection limit. Treat that duration as specific to the deployment, not as a universal Cloudflare or n8n limit. Check the current limits for your Cloudflare plan, n8n hosting arrangement, and reverse proxy in their official documentation.

A 524 alone does not prove that n8n failed. Cloudflare may close the connection while n8n continues processing. The execution might finish later. The sender may then retry, which can create duplicate records, messages, payments, or notifications.

Before you start

Start with a harmless test payload or workflow. Record the exact URL, method, request body, response mode, and a correlation or request identifier when the sender supports one. These details let you compare the request across Cloudflare, the proxy, n8n, and downstream services.

Do not expose an n8n origin publicly just to bypass Cloudflare. A direct-origin test can change TLS, routing, authentication, rate limits, and access controls. Use an existing safe, authenticated origin or internal route when your deployment provides one. Confirm that it reaches the same intended n8n instance.

Preserve relevant n8n execution data, reverse-proxy logs, server logs, downstream-service events, and Cloudflare request information before changing settings. If execution data is disabled, redacted, or expired, reproduce the issue with a harmless correlation ID. Use only the logging level allowed by your privacy and retention policies.

Trace the request before changing a timeout

Start with the smallest reversible test. Compare the production URL through Cloudflare with a minimal webhook that responds immediately. If a safe route exists, compare the same request with a direct-origin route.

  1. Send a harmless request to the production webhook through Cloudflare. Save the request timestamp.
Linux shell
curl -i --max-time 30 -X POST 'https://example.com/webhook/test' -H 'Content-Type: application/json' --data '{"probe":"524-test"}'
  1. Check whether the minimal Webhook-node workflow responds promptly through the same Cloudflare URL. If it does, add the real nodes back gradually. If it does not, focus on DNS, routing, TLS, authentication, proxy rules, n8n availability, and the deployment before investigating business logic.
  2. If your deployment provides a safe direct-origin or internal route, send the same method and payload there. Do not create a new public bypass for this test.
Linux shell
curl -i --max-time 30 -X POST 'https://origin.example.net/webhook/test' -H 'Content-Type: application/json' --data '{"probe":"524-test"}'
  1. Compare the responses and timestamps. If the direct request responds but the Cloudflare request times out, inspect Cloudflare or the proxy path. If both requests hang, inspect n8n and the workflow. The comparison matters only when both requests reach the same intended n8n instance, path, container, ingress rule, authentication policy, and payload.

Use timestamps and logs to locate the stalled layer

Use one timeline to find the stalled layer. Compare the client request, Cloudflare information, proxy access log, n8n execution times, and downstream events. The last layer with matching evidence usually shows where to continue.

  • Cloudflare analytics or request logs: Confirm that the request reached the zone. Compare its status, method, path, and timestamp. Check whether the issue is isolated or widespread. Available fields and retention depend on your Cloudflare plan. Verify them in the current Cloudflare documentation.
  • Nginx, Traefik, or ingress logs: Look for an upstream connection, response time, status code, connection reset, or timeout. If the request is absent, it may have stopped before the proxy.
  • n8n execution data: Find an execution that started at the same time. A started execution with later node activity shows that n8n received the request. If it succeeds after the caller sees 524, the client-facing connection likely timed out while the workflow continued.
  • Workflow and downstream logs: Find the last completed node. Slow HTTP calls, database waits, large binary handling, polling loops, rate limits, and external services can delay the response. Confirm the cause with timestamps.

Use the results to choose the next layer:

EvidenceMost likely area to inspect next
No Cloudflare or proxy entryDNS, TLS, routing, access, or an earlier network layer
Proxy entry with no upstream responsen8n, the proxy-to-n8n path, or an overloaded origin
n8n execution starts and continues after 524Workflow duration and synchronous request design
Minimal webhook works but the real workflow does notA workflow node or downstream service

These directions are not proof. Confirm each branch with the matching log or execution record.

Choose the response mode and workflow shape

Choose synchronous processing only when the caller needs an immediate result and the workflow fits every deadline. Use immediate acknowledgement with asynchronous processing for long API calls, polling, file operations, or human approval. This keeps the original connection short and moves longer work out of the request path.

For a synchronous webhook:

  1. Put validation and authentication near the start of the workflow.
  2. Remove unnecessary API calls, polling, file processing, and human waits from the request path.
  3. Set the Webhook node’s response behavior to match the workflow design. n8n versions and node options differ, so confirm the labels in your installed version.
  4. Use immediate response mode only when the required response does not depend on later work. For a verification callback, return the supplied challenge after validating the request. A minimal n8n Cloud example did this but still timed out. That suggests the issue can occur before or around the webhook endpoint, rather than in later workflow nodes.
  5. Test through the real Cloudflare URL and inspect the execution record. You want a prompt HTTP response and an execution that finishes within the caller’s timeout.

For long-running work, use an asynchronous pattern:

  1. Validate and authenticate the request.
  2. Create a durable job or idempotency record before acknowledging acceptance.
  3. Return an acknowledgement with a job identifier. The status code and response body must match the caller’s contract.
  4. Let a queue or worker perform API calls, polling, file operations, and notifications. Redis, PostgreSQL, or a queue supported by your deployment may provide job state. The n8n queue-mode and worker setup must match your current n8n version and hosting model.
  5. Provide a status endpoint, callback, or later delivery mechanism when the caller needs the final result.

Persist the job before telling the caller it was accepted. If the process acknowledges the request and crashes before saving the job, the caller receives a false success. Keeping the original connection open is not a substitute for durable job state.

An n8n webhook workflow displays an immediate response step on a monitor.
An n8n webhook workflow displays an immediate response step on a monitor.

Decide whether a timeout change is appropriate

Change a timeout only after you confirm that the workflow is bounded and the request reaches a healthy origin. The caller must also be able to wait safely. Every layer must support the chosen duration, or the change will not solve the problem.

A self-hosted operator may control Nginx, Traefik, an ingress controller, and Cloudflare settings. Check the current official documentation for each component. Available controls, plan limits, and n8n Cloud controls vary. Raising a proxy timeout cannot make a slow downstream service faster. It also does nothing if Cloudflare closes the connection earlier. Longer connections consume resources and can make retries more expensive.

If the workflow is long, unbounded, or prone to retries, stop extending the request timeout. Move the work out of the webhook path instead.

Prevent retries from creating duplicate work

Assume that a webhook delivery can be retried unless the sender explicitly guarantees otherwise. After a 524, the sender cannot reliably know whether n8n completed the work. Use a stable event or idempotency key and durable state to prevent duplicate jobs and side effects.

  1. Validate the request and identify its event or idempotency key.
  2. Atomically create a received or processing record if that key does not already exist.
  3. If the key has a completed result, return or reuse that result.
  4. If it is still processing, do not start a second job.
  5. If it is marked failed, retry only under an explicit policy.
  6. Mark completion after the important side effect succeeds. Record enough status to investigate failures.

Use a sender-supplied idempotency key when possible. If none exists, derive a stable event identifier from trusted event data. Do not generate a new random value for each retry. Store the key with a unique constraint in durable storage, such as PostgreSQL, before performing non-repeatable work.

Do not rely on an n8n execution ID alone unless it stays stable across sender retries. Separate deliveries can receive separate executions. The exact transaction and lock behavior depends on the database and workflow design.

Verify the fix

Verify the change through the real Cloudflare URL. Run the harmless test first, then test the real workflow with a controlled payload. Confirm both the timing and the execution result before declaring the issue fixed.

  • The minimal webhook returns promptly through Cloudflare.
  • The direct-origin comparison, when safely available, reaches the same instance and behaves consistently.
  • Cloudflare, proxy, and n8n records contain matching timestamps and the same correlation ID.
  • The real workflow finishes before the caller and proxy deadlines, or the caller receives a durable asynchronous acknowledgement instead.
  • Repeating the same event does not create a second job or repeat a non-repeatable side effect.
  • The final result is available through the agreed status, callback, or delivery mechanism without keeping the original connection open.

Conclusion

Start with the minimal webhook and compare timestamps across Cloudflare, the proxy, n8n, and the last workflow node. Change a timeout only for bounded synchronous work. Otherwise, acknowledge after durable job creation, process asynchronously, and make retries idempotent.

Frequently Asked Questions

Can n8n finish a webhook after the caller receives Cloudflare 524?

Yes. n8n can continue and finish if it accepted the request before Cloudflare closed the connection. Check the n8n execution record and downstream logs. A retry can then duplicate the work, so use durable state and idempotency controls.

Should I increase the Cloudflare timeout for an n8n webhook?

Only if the workflow is bounded, the caller can wait safely, and every layer supports the required deadline. A higher setting will not repair a stalled origin or slow downstream service. For long jobs, acknowledge durably and process them asynchronously.

How can I test an n8n webhook without Cloudflare?

Use a safe direct-origin or internal route provided by your deployment. Send the same harmless request there and compare its status and timing with the Cloudflare URL. Do not expose an origin publicly just to bypass the proxy. The test can change TLS, routing, authentication, and access controls.

Sources

Cloud & Routing Desk

Think Tech Editorial

Troubleshooting guides for reverse proxies, TLS routing, and self-hosted PaaS deployments.