I see HTTP requests failing because of unresolvable names ("getaddrinfo ENOTFOUND").
The names could be resolved if the original CNAME entry delivered back from the server would be used for another request. It is my understanding that this the expected behavior from a client trying to get a name resolved. Am I missing something?
I think I found a reason why this is happening but I'm still not sure the behavior is correct or if my pihole does something wrong.
The response to the query for mail.google.com. includes both, the CNAME and the respective A record (verified with dig from the command line). The response for influxdb.lan. from my pihole instance only returns the CNAME record and no corresponding A entry (database.lan). If it matters, /etc/hosts does not contain influxdb.lan but database.lan.
Edit: Just to be clear, this is on a different protocol level. Name resolution happens before the actual GET request that could encounter a 301 redirect.
Assuming that you are getting back a definitive IP address that you can access, as far as I can see, that should work. The CNAME to IP address conversion should happen at the DNS level so I don't believe that Node-RED would have any issues.
Have you tried doing the nslookup from an exec node inside Node-RED? I think the problem is much more likely to be related to your environment.
Unfortunately, without an equivalent example, I can't reproduce your issue so not sure what I can do to help.
Nice DNS servers serve both records (CNAME and A) in the first response. But when it only gets a CNAME response, the expected behavior of a client is to ask again but this time with the name extracted from the CNAME record.
Pihole's DNS implementation doesn't seem to be nice but it should still work and clients should follow up with a second query. Regrettably, I don't know a publicly accessible DNS server that behaves as unfriendly as pihole's.
I use pihole and have not had any problems. Can you post an example that I can import, which uses a publicly accessible site that causes the problem when pihole is enabled?
I solved my issue by adding an explicit DNS entry for the canonical host in pihole. Queries now get a response with the alias and the proper A record.
Even though my situation is solved, I am not sure if the HTTP node should not issue another query after initially only receiving a CNAME record (this source confirms the assumption that a second query should be issued). Regrettably, I cannot point to an example of a DNS server showing this kind of behavior for further testing.