I’m not familiar with ubiquiti routers/firewalls as I use enterprise gear at home so I can’t be sure myself. But I did do a quick search and find this reddit post Hairpin NAT (loopback) possible with Unifi Express? : Ubiquiti (reddit.com) which seems to indicate there is a known issue with this and it has a possible solution.