Nginx issue Connection timed out Error code 522

Good day to everybody.

Firstly let me say that I have a perfectly running environment where nginx runs on my home server on a ubuntu VM and home assistant runs on a raspberry pi. I’m making use of cloudflare.

I am trying to setup a very similar environment for a friend, even the routers are the same brand, slightly different model. I thought this would be a piece of cake as I can apply almost everything from my setup but things turn out differently.

I have pointed domain/subdomain to the external ip address in the cloudflare. NPM is installed as hassio addon with default settings, created entry for subdomain.domain.ga redirecting to http://192.168.0.31:8123 (ip address of HA) with websocket support . Port forwarding is done 443 → 443. configuration.yaml applied the same as, even broader than mine.

http:
use_x_forwarded_for: true
trusted_proxies:
- ::1
- 127.0.0.1
- 192.168.0.1/24 (Home network)
- 172.16.0.0/12 (all container ip range)

However, whatever I try, I come accross this stubborn 552 error.
– When I port forward 8123 → 8123, I can reach to home assistant via external ip address.
– To test, I have port forwarded 8123 → 443 and in the NPM created entry for the external ip address redirecting to http://192.168.0.31:8123 and when I use https://ExternalIpAddress:8123, then HA is reachable, of course with ssl certificate warning.

I was going to suspect that somehow nginx cannot get the request but trying http://ExternalIpAddress:8123 (HTTP) I get 400 bad request error from nginx so nginx looks like getting and handling the request. Then the only other thing to suspect was the ISP, Proximus Belgium, according to me and I have just come accross this topic DNS request to NameServer are FAILED - Website, Application, Performance / DNS & Network - Cloudflare Community

So let me post this at least as information.