Is it possible that multiple cookies exist for this app (domain name)?
In that case it might be possible that originURI cookie is not the first, and since cookies are separated by “; “ (semicolon+space) the default code from e.g. index-example.html is incorrect. Default code works only if cookies are separated by only a semicolon.
You might try to change index3.html and add " *” before originURI:
if (!document.cookie || !document.cookie.match(/(^|;)originURI=/gi))
document.cookie = "originURI=/login.html" + (window.location.protocol === "https:" ? ";SameSite=None;Secure" : "");
</script>
=>
if (!document.cookie || !document.cookie.match(/(^|;) *originURI=/gi))
document.cookie = "originURI=/login.html" + (window.location.protocol === "https:" ? ";SameSite=None;Secure" : "");
</script>