diff --git a/src/hooks/useLookup.tsx b/src/hooks/useLookup.tsx index cb4c1b7..ba3c32e 100644 --- a/src/hooks/useLookup.tsx +++ b/src/hooks/useLookup.tsx @@ -30,6 +30,9 @@ const useLookup = (warningHandler?: WarningHandler) => { const [error, setError] = useState(null); const [target, setTarget] = useState(""); + // Used to allow repeatable lookups when weird errors happen. + const repeatableRef = useRef(""); + const uriType = useMemo( function () { return getType(target) ?? "unknown"; @@ -155,6 +158,15 @@ const useLookup = (warningHandler?: WarningHandler) => { case "domain": { await loadBootstrap("domain"); const url = getRegistryURL(targetType, target); + + if (url.startsWith("http://") && url != repeatableRef.current) { + repeatableRef.current = url; + throw new Error( + "The registry this domain belongs to uses HTTP, which is not secure. " + + "In order to prevent a cryptic error from appearing due to mixed active content, " + + "or worse, a CORS error, this lookup has been blocked. Try again to force the lookup." + ); + } return await getAndParse(url, DomainSchema); } case "autnum": {