Better handle redirects for XMLHttpRequest origins