You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When probing an endpoint that redirects to a different URL, the both the A and AAAA record are queried for the URL being redirected to. The preferred_ip_protocol and ip_protocol_fallback are not considered.
Previously this issue has been reported also for the initial HTTP request (#724) and been fixed in (#728).
Let us consider the following example:
http://example.com:8080/example redirects to /example/ (resulting URL http://example:8080/example/)
http://example.com:8080/example/ redirects to https://example.com:8443/example/
Then the blackbox_exporter will first resolve example.com and only query the A record because preferred_ip_protocol and ip_protocol_fallback are considered correctly (source). Then the hostname is replaced with the IP in the URL (source). The subsequent HTTP request will return a redirect with path only (to /example/). Thus, the IP is kept as the hostname and no additional DNS query is made yet. The next HTTP query (to http://example.com:8080/example/) redirects to a full URL (https://example.com:8443/example/). This redirect (as the first one) is handled by the HTTP client that does not know about the desired protocol and will query both A and AAAA whereas only the A query is desired.
Also relevant, the output from tcpdump -i eth0 udp port 53:
11:42:50.734383 IP [our host].57761 > [DNS server]: 8334+ A? example.com. (39)
11:42:50.744439 IP [DNS server] > [our host].57761: 8334 1/0/0 A 192.0.2.1 (55)
11:42:50.750098 IP [our host].44199 > [DNS server]: 46571+ AAAA? example.com. (39)
11:42:50.750324 IP [our host.50250 > [DNS server]: 21593+ A? example.com. (39)
11:42:50.759275 IP [DNS server] > [our host].50250: 21593 1/0/0 A 192.0.21 (55)
11:42:50.759382 IP [DNS server] > [our host].44199: 46571 0/1/0 (123)
This shows the first DNS query, correctly querying only for A, as well as the second query querying for both A and AAAA. (Also the AAAA response is missing which introduces the ~5s delay of the DNS timeout.)
What did you expect to see?
Only A queries are made, even for redirects to different URLs.
What did you see instead?
See tcpdump output above. After the redirect another DNS query is made for both A and AAAA records.
The text was updated successfully, but these errors were encountered:
@hashworks Did you test against an URL that does a redirect? It does work for the first URL, but the DNS query for the redirect URL is made for A and AAAA record even though only A should be queried.. Also, it's probably best to verify this from TCP dumps, because otherwise it becomes only noticeable with the ~5s delay in combination with some firewall (or similar) that drops the AAAA response. Without that everything will likely seem to work fine.
When probing an endpoint that redirects to a different URL, the both the A and AAAA record are queried for the URL being redirected to. The
preferred_ip_protocol
andip_protocol_fallback
are not considered.Previously this issue has been reported also for the initial HTTP request (#724) and been fixed in (#728).
Let us consider the following example:
http://example.com:8080/example
redirects to/example/
(resulting URLhttp://example:8080/example/
)http://example.com:8080/example/
redirects tohttps://example.com:8443/example/
Then the blackbox_exporter will first resolve
example.com
and only query theA
record becausepreferred_ip_protocol
andip_protocol_fallback
are considered correctly (source). Then the hostname is replaced with the IP in the URL (source). The subsequent HTTP request will return a redirect with path only (to/example/
). Thus, the IP is kept as the hostname and no additional DNS query is made yet. The next HTTP query (tohttp://example.com:8080/example/
) redirects to a full URL (https://example.com:8443/example/
). This redirect (as the first one) is handled by the HTTP client that does not know about the desired protocol and will query both A and AAAA whereas only the A query is desired.This is a problem as some firewalls seem to block the AAAA response if it is too late after the A response. Then the DNS resolution will wait for a timeout (~5s) and probing the URL might run into a timeout too even though it would be reachable.
Host operating system: output of
uname -a
Linux [redacted] 4.18.0-348.20.1.el8_5.x86_64 #1 SMP Thu Mar 10 20:59:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
blackbox_exporter version: output of
blackbox_exporter --version
What is the blackbox.yml module config.
What is the prometheus.yml scrape config.
irrelevant, can be reproduced by manually scraping with:
What logging output did you get from adding
&debug=true
to the probe URL?Also relevant, the output from
tcpdump -i eth0 udp port 53
:This shows the first DNS query, correctly querying only for
A
, as well as the second query querying for bothA
andAAAA
. (Also theAAAA
response is missing which introduces the ~5s delay of the DNS timeout.)What did you expect to see?
Only
A
queries are made, even for redirects to different URLs.What did you see instead?
See tcpdump output above. After the redirect another DNS query is made for both
A
andAAAA
records.The text was updated successfully, but these errors were encountered: