Is possible to run HA on https when port 443 is already open?

Hello, is possible to run HA on https when port 443 is already open? Because I don’t think so. I am trying for hours and I am so tired and lost how complicated this is.

My main machine is 192.168.0.110 here is nginx running.
My HA is HAOS running on KVM (192.168.0.73) on that main/host machine.

Port 80 and 443 are open for 192.168.0.110.

My nginx reverse proxy:

server {
if ($host = domain.xyz) {
return 301 https://$host$request_uri;
}

 listen 80;
 server_name domain.xyz;
 return 301 https://$host$request_uri;

}

server {
server_name domain.xyz;
ssl_certificate /etc/letsencrypt/live/domain.xyz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.xyz/privkey.pem;

 location / {
     proxy_pass http://192.168.0.73:8123;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection 'upgrade';
     proxy_set_header Host $host;
     proxy_cache_bypass $http_upgrade;
 }
 listen 443 ssl;

}

My HA configuration is:

http:
use_x_forwarded_for: true
trusted_proxies: 192.168.0.110

Atm when I go to https://domain.xyz it says SSL is OK, but I am getting 502 Bad Gateway.

Can somebody help me with it please?

All URLs have a port number too.
If you write https://myha.mydomain.com/, then you have given no port number, but because your URL starts with https, then the default is assumed and it is actually rewritten to https://myha.mydomain.com:443/

You can choose to give a port number in your URL too, which means you can write https://myha.mydomain.com:8123/ or https://myha.mydomain.com:444/ or whatever port number you decide.

Rewritten? No, it’s not “rewritten”. Lol where do you come up with this stuff?

I am getting 502 Bad Gateway.

“Interpreted” might be a better word, but otherwise it is a good explanation.

“Other than that, Mrs. Lincoln, how was the play?”