checkImgSrcPromise = (imgUrl) => {
  const imgCheckTimeout = 15000

  return new Promise((resolve, reject) => {
    const timeout = () => {
      if (!timer) return false
      clearTimeout(timer)
      timer = null
      return true
    }

    let timer = setTimeout(() => { if (timeout()) reject(new Error(`Image load timed out after ${imgCheckTimeout / 1000} seconds for URL: ${imgUrl}`)) }, imgCheckTimeout)
    const img = new Image()

    img.onerror = () => {
      timeout()
      reject(new Error(`Failed to load image from URL: ${imgUrl}`))
    }

    img.onload = () => {
      // subdomain works
      timeout()
      resolve()
    }

    img.src = imgUrl
  })
}
we check if gateway is up by loading 1x1 px image:
this is more robust check than loading js, as it won't be blocked
by privacy protections present in modern browsers or in extensions such as Privacy Badger