Applying a permanent Cloudflare Tunnel Error 1033 and 502 Bad Gateway fix starts with separating which hop of your tunnel failed. As documented in Cloudflare One's Official Common Tunnel Errors Documentation (updated October 12, 2026) and Cloudflare's Tunnel Troubleshooting Manual (September 11, 2026), Error 1033 (Argo Tunnel error) means Cloudflare's edge cannot reach your cloudflared connector at all (or your DNS CNAME points to the wrong tunnel UUID), whereas a 502 Bad Gateway (Unable to reach the origin service) means your cloudflared tunnel is healthy and connected to Cloudflare, but failed at the final local hop between cloudflared and your origin container or service.
cloudflared tunnel list, verify the cloudflared systemd service or container is running, allow outbound port 7844 (TCP and UDP) plus ICMP in your firewall, and confirm your DNS CNAME points to <TUNNEL-UUID>.cfargotunnel.com (UnknownProxies Error 1033 Guide; Cloudflare Docs). If visitors see 502 Bad Gateway on a self-hosted app like Portainer, Proxmox, or Nextcloud, fix the three classic final-hop bugs in /etc/cloudflared/config.yml: (1) HTTP vs. HTTPS port mismatch (e.g., :9000 vs. :9443), (2) self-signed origin TLS rejection (add noTLSVerify: true under originRequest), or (3) Docker bridge network isolation between the cloudflared container and your app container (OneUptime Cloudflare Tunnel 502 Guide). See our Problem and Solution archive for companion reverse-proxy fixes.
1. Cloudflare Tunnel Error 1033 vs. 502 Bad Gateway Diagnostic Matrix (2026)
Match your exact browser error code or cloudflared log message in the table below (Cloudflare One Common Errors; UnknownProxies; OneUptime):
| Symptom / Error Signature | Where the Connection Failed | Primary Root Causes | Permanent Configuration Fix |
|---|---|---|---|
Error 1033: Argo Tunnel error (Tunnel status Inactive / Down) |
Cloudflare Edge → cloudflared Connector |
cloudflared daemon crashed or host rebooted; outbound port 7844 (TCP/UDP) blocked by firewall (UnknownProxies; Cloudflare Docs) |
Run sudo systemctl enable --now cloudflared (or restart: unless-stopped in Docker) and allow outbound TCP/UDP 7844 (UnknownProxies) |
Error 1033 while Tunnel shows Active / Healthy |
Cloudflare DNS → Tunnel Subdomain Routing | Hostname CNAME points to an old deleted Tunnel UUID, or a FedRAMP High account points to <UUID>.cfargotunnel.com instead of <UUID>.fed-cfargotunnel.com (Cloudflare Docs) |
Update the DNS CNAME target to match the active tunnel's exact <TUNNEL-UUID>.cfargotunnel.com (Cloudflare Troubleshooting) |
502 Bad Gateway (x509: certificate signed by unknown authority in logs) |
cloudflared Connector → Local HTTPS Origin (e.g. Portainer :9443) |
Ingress rule uses https:// against a local service with a self-signed TLS certificate, and cloudflared rejects the handshake (OneUptime) |
Configure caPool or set noTLSVerify: true under originRequest in /etc/cloudflared/config.yml (OneUptime) |
502 Bad Gateway (connect: connection refused or no such host) |
cloudflared Container → Local Docker Container |
cloudflared runs inside Docker and points to http://localhost:3000 (its own container loopback) or a container name on a different Docker network (OneUptime) |
Attach both cloudflared and the origin container to a shared external Docker network and route by container service name (OneUptime) |
2. Step-by-Step Repair for Cloudflare Tunnel Error 1033 & 502 Bad Gateway
Step 1: Audit Tunnel Health, Outbound Port 7844 & Local Origin Reachability
Run the terminal checks below on your Linux host to verify whether cloudflared is actively registered with Cloudflare's edge and whether your local origin service responds on the exact protocol and port configured in your ingress rules (Cloudflare Docs; UnknownProxies; OneUptime):
Step 2: Fix Self-Signed TLS & Host Header 502s in /etc/cloudflared/config.yml
When exposing local HTTPS dashboards such as Portainer (:9443) or Proxmox (:8006) through a locally managed Cloudflare Tunnel, cloudflared verifies the origin's TLS certificate by default and returns a 502 Bad Gateway if the certificate is self-signed (OneUptime). Add a per-hostname originRequest block with noTLSVerify: true (or a custom caPool) and always end ingress with the mandatory http_status:404 catch-all rule (OneUptime; Kuryzhev Cloud):
# /etc/cloudflared/config.yml
tunnel: 6ff42ae2-0000-4000-8000-123456789abc
credentials-file: /etc/cloudflared/6ff42ae2-0000-4000-8000-123456789abc.json
ingress:
# 1. Local HTTP service (e.g., Node.js / n8n / FastAPI on port 3000)
- hostname: api.example.com
service: http://127.0.0.1:3000
originRequest:
connectTimeout: 30s
httpHostHeader: api.example.com
# 2. Local HTTPS dashboard with self-signed cert (e.g., Portainer on :9443)
- hostname: portainer.example.com
service: https://127.0.0.1:9443
originRequest:
noTLSVerify: true
connectTimeout: 30s
# 3. Mandatory catch-all rule required by cloudflared ingress validator
- service: http_status:404
Step 3: Fix Docker Network Isolation Between cloudflared and Origin Containers
If you run cloudflared inside Docker Compose, never point your tunnel service URL to http://localhost:9000—inside a container, localhost refers to the cloudflared container itself, causing an immediate 502 error (OneUptime). Place cloudflared and your application containers on the same explicit Docker network and reference the target container by its service name (e.g., https://portainer:9443 or http://app:3000) (OneUptime):
services:
cloudflared:
image: cloudflare/cloudflared:latest
container_name: cloudflared
restart: unless-stopped
command: tunnel --no-autoupdate run
environment:
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
networks:
- tunnel_net
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
networks:
- tunnel_net
networks:
tunnel_net:
name: tunnel_net
driver: bridge
volumes:
portainer_data:
3. Related Guides on The Practical Stack
- How to Fix 502 Bad Gateway in Nginx, Cloudflare & Docker Compose — diagnose upstream socket timeouts, buffer overflows, and stale Docker DNS IPs.
- Problem and Solution Troubleshooting Archive — step-by-step fixes for
PostgreSQL FATAL: sorry, too many clients already,ECONNREFUSED, and Cloudflare Error 522. - Open-Source SaaS & Self-Hosting Guides — deploy Coolify, Dokploy, and self-hosted backends safely behind zero-trust tunnels.
Related guides: Fix 502 Bad Gateway in Nginx · PostgreSQL 'too many clients' fix · Qwen2.5-Coder vs DeepSeek-V3 benchmark · Free AI API rate limits compared
Browse every guide on the site in our HTML sitemap.
Estimate your API spend with our Free LLM API Quota & Cost Calculator.