Plugin: dnslink-fetch

This transport plugin uses standard fetch() to retrieve remote content from alternative endpoints — that is, HTTPS endpoints that are not in the original domain. This enables retrieving content even if the website on the original domain is down for whatever reason. The list of alternative endpoints is itself retrieved using DNSLink for the original domain.

Compare: alt-fetch.

As per LibResilient architecture, this plugin adds X-LibResilient-Method and X-LibResilient-ETag headers to the returned response.


The dnslink-fetch plugin supports the following configuration options:


When fetching an URL, dnslink-fetch removes the scheme and domain component. Then, for each alternative endpoint that is used for this particular request (up to concurrency of endpoints, as described above), it concatenates the endpoint with the remaining URL part. Finally, it performs a fetch() request for every URL construed in such a way.

Let’s say the plugin is deployed for website, with concurrency set to 2 and these are the alternative endpoints specified in relevant TXT records according to the DNSLink specification (so, in multiaddr form):

Notice: dnslink-fetch currently only supports a rudimentary, naïve form of multiaddr addresses, which is /https/domain_name[/optional/path]; full mutiaddr support might be implemented at a later date.

A visitor, who has visited the website at least once before (and so, LibResilient is loaded and working), tries to access it. For whatever reason, the site is down or otherwise inaccessible, and so the dnslink-fetch plugin kicks in.

The request for is being handled thus:

  1. scheme and domain removed: index.html
  2. two (based on concurrency setting) random alternative endpoints selected:
    • dnslink=/https/
    • dnslink=/https/
  3. resolve endpoint multiaddrs to URL of each endpoint:
  4. fetch() request issued simultaneously for URL (so, alternative endpoint concatenated with the path from hte original request):
  5. the first successful response from either gets returned as the response for the whole plugin call.