After implementing self-signed certificate, bad gateway 503

I’ve changed my local access to homeassistant from http to https successfully with my self-signed certificate by adding cert and private key path in configuration.yaml.
https://192.xxx.xx.xx:8123 or https://homeassistant.local:8123 works without problem.
However, if I access it outside my home by using my subdomain name hassio.mydomain.com, it no longer works, with a return error 503.
I’ve changed the backend on my pfSense HAProxy, Encryption=yes (from “No”), check=no.
I don’t know what has caused this 503 error.
FYI, I’m using cloudflare DNS for my domain/subdomain name.