Issue with cloudflared + NPM

Sorry if this is a issue that has a lot of posts, but none of them solve my issue.

I have a HA instance (through Docker compose using the ghcr.io image) that was routed externally using the local HTTP IP through cloudflared, but I wanted to add NPM because I didn’t want cloudflare to encrypt my data.

I used a duckdns domain for the local cert, and configured it as the Proxy Host. HA is accessible through ha.x.duckdns.org in my browser. I added the NPM local IP in the config.yml of HA, so that it’s able to route it.

Cloudflared is setup so that it uses the duckdns IP and routes it publicly:
https://ha.x.duckdns.org -> https://ha.example.com.
But, when accessing ha.example.com, I get a 502 error, and the cloudflared logs say:

2024-04-15T03:57:02Z ERR Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic 
from cloudflared: EOF" connIndex=0 dest=https://ha.example.com/ event=0 ip=198.41.192.xx type=http

I don’t know why it says type=http, since in the cloudflare web UI I have it setup as HTTPS. I also tried adding that IP to the config.yml file of HA, but it didn’t fix it.

Any ideas?