HTTP 522 from internet but works from local network

I set up a cloudflare ssl certification for my server using Nginx HA SSL Proxy. It works from inside my network, I can reach HA on the SSL port as expected, but if I try to access it from outside my network I can only see a HA logo and some pending requests for .js resources for about 20s, then all throw http 522.

It worked from outside as well before I changed it to an other port and added ssl config. The port forward on my router points to the new port number. I get the same error if I use my current ip address with https and proper port number.

My http config:

http:
  server_port: 8443
  ssl_certificate: /config/certificate/origin.pem
  ssl_key: /config/certificate/privkey.pem
  use_x_forwarded_for: true
  trusted_proxies:
    - ::1
    - 127.0.0.1
    - 192.168.0.0/24
    - 192.168.50.0/24
    - 192.168.50.211
    - 173.245.48.0/20
    - 103.21.244.0/22
    - 103.22.200.0/22
    - 103.31.4.0/22
    - 141.101.64.0/18
    - 108.162.192.0/18
    - 190.93.240.0/20
    - 188.114.96.0/20
    - 197.234.240.0/22
    - 198.41.128.0/17
    - 162.158.0.0/15
    - 104.16.0.0/13
    - 104.24.0.0/14
    - 172.64.0.0/13
    - 131.0.72.0/22

Another question: I can reach HA on SSL 8443 but the browser complained about it the first time. How can I tell HA mobile app to accept this certificate or disable certificate validation on my local network?