pakopress.dev — SDK fallback via DNS TXT (DoH)

The SDK loads from a primary source; if the <script> fires onerror, the loader does not hard-code the fallback URL. It asks public DoH resolvers (Cloudflare, Google, AliDNS, in parallel) for the TXT record id5-api-alt-cdn.eu-2-id5-sync.com, base64-decodes the first answer into a full URL, and loads the SDK from there. The DoH requests go to the resolvers' own hosts, so they are unaffected by blocking of id5-sync.com traffic. Add ?break=1 to force the primary to a dead host as a sanity check.

Waiting for ID5…

ID5 init — first-party calls

partnerId: 173
apiBaseUrl: https://edge.pakopress.dev/a7q3 — first-party (same registrable domain as the page)
Effect: once the SDK is loaded (primary or DNS fallback), every ID5 ID fetch goes first-party to the edge (edge.pakopress.dev → CNAME edge.eu-2-id5-sync.com), so the ID5 ID resolves without a request ever keyed on id5-sync.com.

Loader log

    Resolved fallback

    resolves after the primary fails…

    What this tests

    The fallback CDN is not shipped in the page — it lives in DNS. On onerror the loader reads a TXT record over DoH and decodes a base64 URL, so the alternate CDN can be rotated by editing one DNS record, with no page change. The lookup hits public resolvers over HTTPS, not id5-sync.com, so request blocking on that domain does not catch it. It queries three resolvers in parallel and takes the first answer, with cache: 'no-store', so one resolver's stale negative cache can't stall the fallback.

    // 1. primary <script> onerror → resolve the alternate CDN from DNS (first resolver to answer wins)
    Promise.all(RESOLVERS.map(dohQuery)).then(results => {
      var hit = results.find(r => r.txt);
      var url = atob(hit.txt);   // base64 → full SDK URL
      appendScript(url);
    });
    // dohQuery: fetch(r.url, { headers: r.headers, cache: 'no-store' }) → first TXT answer

    DNS record to publish

    Add a TXT record on eu-2-id5-sync.com whose value is the base64 of the alternate SDK URL. Current value points at jsDelivr, SDK 1.0.99:

    nameid5-api-alt-cdn.eu-2-id5-sync.com
    typeTXT
    valueaHR0cHM6Ly9jZG4uanNkZWxpdnIubmV0L25wbS9AaWQ1aW8vaWQ1LWFwaS5qc0AxLjAuOTkvYnVpbGQvZGlzdC9pZDUtYXBpLmpz
    decodes tohttps://cdn.jsdelivr.net/npm/@id5io/id5-api.js@1.0.99/build/dist/id5-api.js

    Requests made by this page

    blue = DoH lookups (Cloudflare / Google / AliDNS) · amber = primary (cdn.id5-sync.com) · indigo = fallback SDK (resolved CDN) · green = first-party ID5 calls (edge.pakopress.dev)

    typehostpath