Arama Yap Mesaj Submit
Request a Callback
+90
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro
X
X

Select Your Currency

Turkish Lira $ US Dollar Euro

Contact Us

Location Halkali merkez neighborhood fatih st ozgur apt no 46 , Kucukcekmece , Istanbul , 34303 , TR
EKA SUNUCU · DEEP TECHNICAL GUIDE

Cloudflare Tunnel Origin Certificate Errors: x509, originServerName and caPool

Diagnose Cloudflare Tunnel x509, unknown authority and 502 origin TLS errors using originServerName, caPool, protocol/port and cloudflared logs.

cloudflared Origin TLS Docker / Reverse Proxy Last technical review: 14 August 2026
Current source-verified findings
01

A Cloudflare Tunnel can show Healthy while users receive 502; in that case the connector is connected to Cloudflare but cloudflared cannot reach the local origin.

02

Cloudflare documents `originServerName` for cases where the origin certificate hostname differs from the service URL hostname.

03

For private/self-signed CAs, Cloudflare documents custom CA trust through `caPool`; `noTLSVerify` is not the recommended first production fix.

01

When is this guide relevant?

cloudflared log: x509: certificate is valid for X, not localhost x509: certificate signed by unknown authority Tunnel dashboard is Healthy but browser shows 502 Bad Gateway Malformed HTTP response caused by wrong http/https scheme or port
02

Separate 1033 from 502 first

Cloudflare Tunnel 1033 means Cloudflare cannot find a healthy connector for the tunnel. A 502 can occur while the connector is online but cloudflared cannot reach the configured local service. Therefore Healthy plus 502 is not contradictory.

This determines the path: for 1033 inspect connector process, network and credentials; for 502 inspect service URL, port, protocol and origin TLS.

Command / check
cloudflared tunnel info TUNNEL_ADI
systemctl status cloudflared
03

Can cloudflared reach the origin from the same host?

If config says `service: https://localhost:8443`, test that exact address from the same host or network namespace where cloudflared runs. Inside Docker, localhost refers to the container itself, not the host.

With containerized cloudflared, it may need to share a Docker network with the reverse proxy and use the service/container name. Tunnel health does not prove origin routing inside Docker is correct.

Command / check
curl -vk https://localhost:8443/
docker network ls
docker inspect cloudflared
04

Match http/https scheme to the origin's real protocol

If the origin speaks plain HTTP on port 8080 but config uses `https://localhost:8080`, cloudflared expects TLS and can report malformed responses or connection errors. The reverse mismatch is also invalid.

Do not infer protocol only from the port number. Use local curl tests to identify what the service actually speaks.

Command / check
curl -v http://localhost:8080/
curl -vk https://localhost:8443/
05

certificate is valid for X, not localhost: use originServerName

If the certificate is for app.internal.example.com but the service URL is https://localhost:8443, hostname validation fails. Cloudflare documents `originServerName` to specify the hostname expected by the certificate.

This does not disable certificate identity validation; it tells cloudflared which hostname to validate. It is a stronger production approach than turning off TLS verification.

Command / check
cloudflared tunnel ingress validate
06

Private CA / self-signed chain: trust it with caPool

`x509: certificate signed by unknown authority` is different from a hostname mismatch. The name can be correct while cloudflared does not trust the issuing private CA. Cloudflare supports a custom CA bundle path through `caPool`.

The CA bundle should contain the correct root/intermediate chain in PEM form and be readable by the cloudflared process/container. In Docker, a host path is not enough; the file must be mounted into the container.

Command / check
openssl verify -CAfile /etc/cloudflared/origin-ca.pem origin-cert.pem
07

Why noTLSVerify should be a last resort

Cloudflare exposes TLS verification bypass as an option but positions it as a last resort rather than the preferred production configuration. Disabling verification weakens origin identity protection.

The durable fix is a certificate for the correct hostname, `originServerName`, or trusted private CA through `caPool`. If a bypass is ever used diagnostically, document the reason and rollback plan.

08

Validate ingress and logs after configuration changes

After editing YAML, validate ingress rules, restart the service and inspect logs. A misplaced catch-all rule can route the hostname to a different origin even when TLS settings are correct.

If x509 errors disappear but 502 remains, move to TCP connectivity, protocol/port and application-response diagnosis. Continue layer by layer rather than forcing one hypothesis.

Command / check
cloudflared tunnel ingress validate
journalctl -u cloudflared -n 200 --no-pager
Diagnostic table

Tunnel error isolation

Symptom Priority
Error 1033 Is a healthy connector connected to Cloudflare?
Healthy + 502 cloudflared → local origin access
x509 valid for X not Y originServerName / certificate hostname
x509 unknown authority Private CA trust / caPool
Risk and implementation note

Before production changes, verify context and keep backups and a rollback plan. Do not change several DNS, TLS, recovery, Docker or WordPress variables at once because it obscures the root cause.

FAQ

Frequently asked questions

If the Tunnel is Healthy, is the origin healthy too?

No. Healthy can mean the connector reaches Cloudflare while cloudflared still cannot reach the local origin.

Is noTLSVerify safe?

It is not the preferred production solution. Configure the correct certificate/hostname or trust the private CA.

Why does localhost fail in Docker cloudflared?

Inside a container, localhost refers to that container. Use the correct shared network and service name/IP for another container or host.

REFERANS

Official and primary technical sources

CLUSTER

Related technical guides

EKA SUNUCU · ALTYAPI VE TEKNİK DESTEK

Connect Cloudflare Tunnel cleanly to your Docker/VPS origin

If the problem persists in hosting, VPS, Docker, Cloudflare, Windows or WordPress infrastructure, open a technical support request with the exact error output and current architecture.

Top