Just add the
inventory_hostname (that must be a fqdn, accessible), to
/etc/hosts, with a loopback IP address.
This way, when behind a NAT, no matter what the public or private IP, the app will be able to query resources from itself, using the public name.
This doesn't break connectivity in public hosts, instead makes self-queries a little faster, as it avoids the DNS query to resolve the name.