Is it possible for XHR HEAD requests to not follow redirects (301 302)

There isn’t, this isn’t exposed behavior you can stop.

It’s because of the spec you linked already, the specified behavior is that XmlHttpRequest should transparently follow redirects…under the covers unfortunately, and not in a way you can prevent.

It’s this way to try and make things easier, if resources move, etc…but when it was designed and the spec laid out, all these redirection services weren’t out there. There just wasn’t a strong need for any other behavior or ability to prevent it, I think with as many redirects hitting the web not we’ll see the ability added, but who knows when every browser would support it.

Leave a Comment