async function expectSubdomainRedirect (url) {
  // Detecting redirects on remote Origins is extra tricky,
  // but we seem to be able to access xhr.responseURL which is enough to see
  // if paths are redirected to subdomains.

  const { url: responseUrl } = await fetch(url.toString())
  const { hostname } = new URL(responseUrl)

  if (!hostname.startsWith(IMG_HASH_1PX)) {
    const msg = `Expected ${url.toString()} to redirect to subdomain '${IMG_HASH_1PX}' but instead received '${responseUrl}'`
    console.error(msg)
    throw new Error(msg)
  }
}
Checks if a given URL redirects to a subdomain that starts with a specific hash.

@param {URL} url - The URL to check for redirection.
@throws {Error} Throws an error if the URL does not redirect to the expected subdomain.
@returns {Promise<void>} A promise that resolves if the URL redirects correctly, otherwise it throws an error.