You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Safari 5.0.5 fails to load m4a via html5 audio when apache basic authentication is used

Has anyone seen this defect?


I have a simple webpage below:


<!DOCTYPE html>

<html>

<head>

<title>Test</title>

</head>

<body>

<audio id="audioplayer" controls>

<source src="res/myaudiofile.m4a" type="audio/mp4" />

<source src="res/myaudiofile.oga" type="audio/ogg" />

</audio>

</body>

</html>


If this webpage is loaded in Safari, the m4a audio loads and I can play it.

But if I enable basic authentication in apache through the .htaccess file, Safari fails to load the m4a file. Instead, it just displays "Loading..." forever:

User uploaded file


Note: I also have the mime types set in the .htaccess file.


I've reproduced this on multiple servers and have not yet confirmed whether upgrading from 5.0.5 to 5.1 will fix this.


Thanks,

Eric

Web development for Safari

Posted on Feb 29, 2012 6:11 PM

Reply
3 replies

Mar 1, 2012 7:29 AM in response to ctangent

[copied from my reply to the related issue mentioned above]


I was able to reproduce an issue using the HTML 5 audio tag and the drupal_goto method in Drupal. In both cases, in Safari 5.0.5 and Safari 5.1.2, in the apache logs, the initial requests to the page include the authenticated user, but the request to download the audio file or the request to go to a new page somehow did not send the authentication information because the request in the log doesn't include anything.


So for example, I am authenticated by apache and submit a form. The page processes the form then uses drupal_goto to redierct to another page. From Chrome, the following appears in the apache log:

::1 - tom [02/Feb/2012:17:23:46 -0500] "POST /drupal/node/6?q=node/6 HTTP/1.1" 302 502

::1 - tom [02/Feb/2012:17:23:46 -0500] "GET /drupal/node/8 HTTP/1.1" 200 3019


When I do the same thing in Safari:

::1 - tom [02/Feb/2012:17:25:50 -0500] "POST /drupal/node/6?q=node/6 HTTP/1.1" 302 502

::1 - - [02/Feb/2012:17:25:50 -0500] "GET /drupal/node/8 HTTP/1.1" 401 401

::1 - tom [02/Feb/2012:17:25:55 -0500] "GET /drupal/node/8 HTTP/1.1" 200 3019


The request after the goto doesn't include authentication information - and I have to put in my username and password.


This is an annoyance in the case of redirection - having to reauthenticate every time - but in the case of HTML 5 audio it is fatal. The audio file specified in the source tag simply does not load.

Mar 1, 2012 5:13 PM in response to ctangent

This is the apache access log for when my html 5 audio page is not protected by apache auth:


127.0.0.1 - - [01/Mar/2012:09:20:06 -0500] "GET /play.html HTTP/1.1" 304 -

127.0.0.1 - - [01/Mar/2012:09:20:07 -0500] "GET /res/myaudiofile.m4a HTTP/1.1" 304 -


This is the apache access log for when my

127.0.0.1 - eric [01/Mar/2012:09:20:48 -0500] "GET /play.html HTTP/1.1" 200 1247

127.0.0.1 - - [01/Mar/2012:09:20:48 -0500] "GET /res/myaudiofile.m4a HTTP/1.1" 401 490


Notice that the first request I'm authenticated (after passing my username) and I show up as "eric". The second request is equivalent to an anonomous request and thus results in a 401 authentication error which occurs "when authentication is possible but has failed or not yet been provided". It is as though Safari is not sending the authentication information required on subsequent requests if the request is a resource from html 5 audio or as the result of a redirect.

Safari 5.0.5 fails to load m4a via html5 audio when apache basic authentication is used

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.