Accessing two HA Pi 4s with two https links via duckdns

I have 2 Pis each running HA. Currently they’re both at home but in a few weeks I will be moving one to another house. I use duckdns to give me external access through https using a url of the form https://firstpi.duckdns.org. For this I have port forwarding in my router for port 443 to the first Pi I set up.

I want to be able to access the second pi in the same way using a url of the form https://secondpi.duckdns.org. However, using this url means my port forwarding rules won’t route that traffic to the right pi.

I’ve read that port 8443 is another port for https but when I try a url of the form https://firstpi.duckdns.org:8443 and route port 8443, it doesn’t work and I get an error ERR_SSL_PROTOCOL_ERROR.

Is what I’m trying to do possible? If so, what am I doing wrong?
Thanks

It’s definitely possible, but not with plain port forwarding.

You’d have to add reverse-proxy like nginx to the equation, which will do the proper forwarding based upon the hostname.