This could be anyhting - unless you really want to debug it, just stick with the IP address (although I appreciate thats not perfect).
What I know, is that the domain name works in my proxy file and network enviroment (the default LXD network enviroment) so its something wrong with “your” setup (not being confrentational just saying - I cant replicate that behavior here (im more “practical” than “theoretical” + I hate networking with a passion so I cant just say “do XYZ” on this issue)
one “practical test” i can think of is put the IPV6 address instead of the domain name of the container and see if that works (that way you know if its a resolve issue or ipv6)
A just to be a 100% when I say the “domain name” i mean the domain name of the webserver I.E nginx_server.lxd
not my_cool_website.com