Operations

A Cloudflare Tunnel turns your form redirect into a 502

10 August 2026 · 4 min read

Validation fails, Laravel returns a 302, and the visitor sees "Service temporarily unavailable" instead of "email is required". Here is why, and what to do.

An operations team diagnosing a Cloudflare tunnel from a shared screen

A POST that answers with a 302 through a Cloudflare Tunnel can surface to the visitor as a 502. The form looks broken; the logs show a successful request with a 302. Nothing in your application is wrong.

The workaround is to stop answering POSTs with a redirect. Flash the errors and the old input to the session as usual, then return a 200 whose body redirects the browser.

Put it in one place

Do this in a base form request, not in each controller. A failedValidation override applies to every public form at once, including the one added six months from now by someone who never heard of this bug.

And gate it behind a config flag. Deployments that are not behind a tunnel should keep standard Laravel semantics, and both paths deserve a test.