# Cloudflare-branded 502 Bad Gateway / 504 Gateway Timeout ("cloudflare" footer)

**Code:** `Cloudflare 502` · **Category:** Cloudflare · **Seen on:** Cloudflare

A plain-looking 502/504 page with “cloudflare” at the bottom comes from Cloudflare’s network itself (or an origin response it couldn’t use), not your server’s error page.

## Meaning

If the page is Cloudflare-branded, either Cloudflare had a temporary problem, or your origin returned an invalid/empty response. If it’s your server’s own 502/504 page (nginx/Apache), the problem is behind Cloudflare (PHP-FPM, upstream app).

## Common causes

- Origin returning malformed/empty responses or resetting connections
- Temporary Cloudflare edge issue (check status)
- Origin firewall/rate limiting Cloudflare IPs intermittently

## Quick fix

1. Check cloudflarestatus.com
2. Compare with a direct request to the origin
3. Allowlist Cloudflare IP ranges on the origin firewall

## Detailed fix by platform

### Shell

1. 

```bash
curl -sI https://example.com | grep -iE '^(HTTP|server|cf-ray)'
curl -sI --resolve example.com:443:ORIGIN_IP https://example.com | head -1
```


## How to diagnose

1. **Branding** — Cloudflare page or your server’s?
2. **Origin** — Direct request result
3. **Status** — Cloudflare incident?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cloudflare/cloudflare-502-504-bad-gateway)
