Hairpin issue / question about how to use dnsmasq to point at localhost

Hello! i have a small issue. when trying to reach itself from my domain, we can call this domain.com, it fails saying “server cannot reach itself on HTTP from domain.com”… normally this issue can be easily solved by editing /etc/hosts to have “127.0.0.1 domain.com” in it. however, that doesn’t seem to be the case on YunoHost. my router doesn’t have NAT Loopback so yunohost’s hairpin tutorial simply doesn’t help at all. however, looking on the list of services i can see dnsmasq… which i’d put money on that as to what would be able to help solve my issue. so now it comes down to "i need server requests for my domain.com to go to 127.0.0.1 and i’d assume that’d happen through the DNS server that’s been hosted… how do i do that? [my DNS servers are being hosted on GoDaddy already and zoning is all set up there just fine. so i don’t even think i need this dns server, but i don’t know what yunohost uses it for.] anyway, super long question sorry about that…

tl;dr: “How do i use dnsmasq to make HTTP requests from the server to itself via domain.com go to 127.0.0.1 instead of my external IP because i do not have hairpinning / NAT loopback at all on my ISP’s router?”

Well uh are you sure that if you add the appropriate line to /etc/hosts, ping yourdomain.tld -c1 doesn’t ping 127.0.0.1 ?

well crap… that does work. which means literally everything i was thinking is wrong and now i’m at square one with “it simply doesn’t work like it should” and anything with the YunoHost command tries to use the external IP when any domain.tld is used… from outside my network i can reach the website just fine… how can i tell yunohost not to refer to itself by its external IP? i thought changing /etc/hosts would do that… but apparently not… but also apparently so at least for ping command

my error is “Timed out when server tried to contact itself through HTTP using public IP address (domain my domain.tld with ip my.ext.ip.addr). You may be experiencing hairpinning issue or the firewall/router ahead of your server is misconfigured.”

so how is that happening if ping works fine?

I dunno, network stuff are always quite mystic … Maybe it tries to contact itself through ipv6 instead of ipv4…

Anyway, I would try to just bypass the check with yunohost domain cert-install yourdomain.tld --no-checks

i guess that works for the most part… its just from the error " Warning: Timed out when server tried to contact itself through HTTP using public IP address (domain mothnet.xyz with ip 67.253.67.120). You may be experiencing hairpinning issue or the firewall/router ahead of your server is misconfigured." it’s like “i just set /etc/hosts to 127.0.0.1 and even as we saw, ping works fine like " root@admin:~# ping mothnet.xyz -c1
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.032 ms”

so my question is just now “where is YunoHost getting this IP?” GoDaddy is taking care of my DNS so how can i set my IP to like, “localhost” or something within yunohost?

but still thanks. that solve like 50% of my hairpin issue there. half was SSL and the other half is a few of the apps like pufferpanel still ignore /etc/hosts too… so i assume its something yunohost is doing. all the game servers and stuff not run by yunohost works perfect and are reachable via the /etc/hosts file and can see themselves. but its just somehow different for the webapps seeing themselves and the game server daemons and all that… though the only apps that cause actual “functionality” issues with not being able to see themselves is certbot which we just dealt with… and pufferpannel for running minecraft, starbound, discordbots, etc… and tbh i could be able to go into settings for it and force it to use localhost instead of like games.mothnet.xyz and have that fixed… but i also think its a valid issue to look into in someone’s free time. like “what if someone else has a hairpin issue like me and doesn’t have a router that does DNS stuff?” my ISP offers it but you have to pay premium for it. so that’s just a no for me. i just wonder what i can change… like dnsmasq configs or something to make the admin panel and webapps see itself as localhost… like if i had multiple IPs and such personally i wouldn’t care which route connections came through as long as i can see the url they want so nginx and yunohost can serve up the right page… so why even let yunohost know what my external IP is after i’ve made it static and set up proper DNS?.. but i know there’s lots of answers to that. useful ones too even. but my point is if there is a way to disable it or set yunohost to use localhost or 127.0.0.1 to check itself and servers, i would… and i want to.

but otherwise, thank you… knowing about the --no-checks switch on that command saved the day. i swear i used it already… but with a --debug switch too. and i guess that errored out in some way even after that UTF-8 error in that other forum post i made

another note: doing that command solved all cache issues i was having on all the other devices.