I've built a Javascript web application which is served from Sharepoint (ie. there is no Sharepoint code at all operating on the web app, it's just some HTML/JS being served from a Sharepoint 2010 Document Library)

I'm displaying HTML5 video and sourcing a file from within the same Document Library, this works absolutely fine on Google Chrome, but if I try with Firefox (or with IE9) then every file I source gets denied twice with an HTTP 401 error before it gets returned with HTTP 200.

The upshot of this is that if I have a very simple HTML file (see below) and run it locally then the video plays fine in all browsers, if I upload the HTML and the video to my company's sharepoint server (into a document library) then it won't load in IE or Firefox - but works fine in Chrome!

        <source src="localvideo.webm" type="video/webm">

If I change the source element to reference a video file on a different server then it, again, works fine so this must be a problem with the way Sharepoint is serving files. Does anyone have any advice on how to work around this problem? Either in Sharepoint or in JS? There is no chance of me being able to edit anything above a site owner's privileges.

  • It's worth mentioning that all other files served in this manner (images, JS files etc) are loaded correctly in all browsers.
    – JP.
    Oct 28, 2011 at 10:44

2 Answers 2


Two HTTP 401 responses is normal when using NTLM authn, that's the way HTTP works.

First it tries an anonymous request which generates the first 401 request. The reponse includes a header that says "try with NTLM".

Then the NTLM procedure (which is a challenge/response method) requires one 401 and finally a 200. If you want more details here's a good link: http://davenport.sourceforge.net/ntlm.html#ntlmHttpAuthentication

If you switch to Kerberos for instance, you will get one 401 (the anonymous request) and then a 200 (when the kerberos token is sent).

(I know this doesn't answer your question completley, but that's why you get two 401's.)

  • 1
    I've never heard anyone explain it so concisely. Thanks, Wictor! Oct 28, 2011 at 11:31
  • 2
    Thanks! The two 401's are one reason why Kerberos can improve performance of your SharePoint. Just take a look at the payload size of the 401's served from IIS - and then two of them for every single HTTP request :-) Oct 28, 2011 at 11:53
  • Just repeating, but this is an awesome question and answer! Thanks! Oct 29, 2011 at 7:54
  • @Wictor:Nice explanation. However, I wonder how Kerberos is faster than NTLM when Kerberos is more complicated process (than NTLM). Nov 19, 2011 at 18:03
  • 1
    @AmitKumawat, there is no guarantee that Kerberos is faster (for instance the http payload is larger compared to NTLM). You have to test! Tests have shown that for short sessions NTLM has larger RPS than Kerberos, and for long sessions (~15-20 mins) Kerberos is faster. It all depends on a number of parameters, such as session time, infrastructure (where are your DC's located), usage patterns etc etc. Test, test, test... Nov 20, 2011 at 9:14

Wictor's answer is an excellent one, but for me the root cause of this issue was IIS' mime-type settings.

IE and Firefox will completely adhere to the mime-type sent by the server (the default one being application/octet-stream for IIS) but also will not play a video if the mime-type isn't correct - video/webm, video/ogg or video/mp4. By contrast Google Chrome will guess the mime-type based on the contents of the file (a dangerous habit already steeped in debate) - hence the difference between the browsers.

The solution to this problem is to add these mime-types to IIS' system settings and reboot (details can be found here). I hope this helps someone else - it took me forever to stumble across this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.