Can't access home assistant via app while on home network

I use Home Assistant in a docker container behind a Nginx reverse proxy which terminates the SSL connection (using a wildcard letsencrypt certificate). I use dnsmasq on the pihole to access the reverse proxy directly while on the home network so I can use the same URL on any network (my router doesn’t support NAT loopback/hairpinning). This works fine for literally all my self-hosted services like nextcloud, gitea, etc. It also works fine when accessing Home Assistant using the web browser.

However, when I try to access Home Assistant via the Android app, lose and don’t regain the connection as soon as I turn on the WiFi and connect to the home network. When I am using the web browser on the same phone, I have no issues.

I configured the URL of my Home Assistant instance in the app when I first logged in which is https://hass.mydomain.duckdns.org.

Does the companion app not use the system DNS server in Android?

I finally resolved this issue. The router provided by my FTTH provider gives out DHCPv6 leases and set itself as DNS server. The app seemed to use the IPv6 path while the Chrome browser used the PiHole DNS on 192.168.1.9.

Unfortunately, the webinterface only allows to disable DHCP for IPv4, so I had to gain root access to the router and disable IPv6 in the sysctl.conf.