Http request node does not work with Hostname only IP

i have a simple GET request node setup to reqest the status of a lamp.
If i trigger it with a hostname that i can reach with any browser it does not work.
As soon as i put the IP of that device instead, it works.

this is the simple flow:
[{"id":"431ec79c.efa0f","type":"http request","z":"ecf5db33.a01038","name":"digitalswitch GET","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://my-device.local:8888/1/properties/switch","tls":"","persist":false,"proxy":"","authType":"basic","credentials":{},"x":970,"y":640,"wires":[["11d1a488.390d03","38ef20d5.5fd8f"]]},{"id":"5a48f3bf.5b5b0c","type":"inject","z":"ecf5db33.a01038","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"true","payloadType":"bool","x":780,"y":640,"wires":[["431ec79c.efa0f"]]},{"id":"38ef20d5.5fd8f","type":"debug","z":"ecf5db33.a01038","name":"get","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1170,"y":640,"wires":[]}]

Is it normal that hostnames do not get resolved?

This will depend on what OS you are running Node-RED on and how it's configured.

.local addresses are resolved using mDNS and traditionally Windows does not support resolve mDNS addresses.

Also If you are running in Docker then it won't be able to resolve mDNS addreses either as the container doesn't have direct access to the local network to do the multicast request.

I have it on a Linux VM and docker running inside it, in host_mode. So I think Docker should not be the problem here, as host_mode makes networks transparent to the host. LVM could be the problem but, I have the Docker host_mode active because of the node-red-contrib-homekit package that needs the mDNS as well, and works since I enabled the host_mode.
I don't exactly know how it is done with my iot-power-switches from 'mystrom' but they get discovered very well.
Bildschirmfoto 2021-08-12 um 06.26.07
Do you know about a test scenario I can go through, to verify that mDNS blocking is responsible for not working .local hostnames?

The node will be doing it's own mDNS discovery to find those devices, where as the HTTP-Request node is just using the normal OS DNS lookup to find the IP address of the hostname you entered.

Docker containers are not setup to do mDNS resolution via this path (it needs edits to the /etc/nsswitch.conf file and avahi installing).

The easier option might be to run a DNS-to-mDNS proxy on the host machine (e.g. GitHub - hardillb/dns-to-mdns: Bridging normal DNS to mDNS that I wrote a while ago for just this sort of problem). You will then need to change the settings on the container to point it to this DNS server. (Container networking | Docker Documentation)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.