-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resolver fallback to the null resolver (getaddrinfo)
This enables a best-effort, two-step resolution when a resolver is configured: - if the DNS resolver returns any domain, that record is used with its corresponding TTL - otherwise, the module tries resolving the name with the default, NULL resolver, which is just a wrapper over getaddrinfo * if the resolution succeeds, this was likely a domain in /etc/hosts or an IP literal, which was not known by the DNS server. The associated record has no TTL value and uses the default director TTL. * if the resolution fails, this was likely a bad domain. No records are stored and a new request is made after the default director TTL, as was done previously.
- Loading branch information
Showing
3 changed files
with
75 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
varnishtest "falling back from a resolver to getaddrinfo" | ||
|
||
server s1 { | ||
rxreq | ||
txresp | ||
} -start | ||
|
||
varnish v1 -vcl+backend { | ||
import ${vmod_dynamic}; | ||
|
||
sub vcl_init { | ||
new r1 = dynamic.resolver(); | ||
new d1 = dynamic.director( | ||
resolver = r1.use()); | ||
d1.debug(true); | ||
} | ||
|
||
sub vcl_recv { | ||
set req.backend_hint = d1.backend(host = "img.localhost", port = "${s1_port}"); | ||
} | ||
} -start | ||
|
||
client c1 { | ||
txreq | ||
rxresp | ||
expect resp.status == 200 | ||
} -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters