You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Works in Chrome and Firefox, but Safari 9.0.1 on OSX and Safari on iOS 9.1 are showing the following error message:
[Error] Failed to load resource: Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers. (216772566.json, line 0)
[Error] XMLHttpRequest cannot load https://api.soundcloud.com/tracks/216772566.json?client_id=2e2d678be10b5a5d2d62af34b194428e. Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers.
Using the SDK at connect.soundcloud.com/sdk/sdk-3.0.0.js as well as soundcloud 3.0.1 on NPM.
this seems to be a server sided problem. in "Access-Control-Allow-Headers"
Accept-Encoding is missing.
workaround for me was to make a little php proxy and modify the soundcloud sdk 3.0.0:
r = new XMLHttpRequest,
r.open(t, 'https://mrvv.net/beta/proxy.php?url='+n, true), //make your own or use mine for the moment..
I am just using the APIs without the Javascript SDK and I have the same bug. This is just a bug in Soundcloud API. How can it be that this bug is there for so long?
I took some time to investigate and fix this today. It will be published in version 3.1.2 of the SDK to both NPM and our connect.soundcloud.com asset hosting domain. I need to work with some others to make sure it goes live.
See #63 for the fix. If anybody has found an official bug report for this behavior in Safari, I'd love to see it. It is a bizarre behavior by the browser, but I wasn't able to find proof of it being recognized as a bug.
View in chrome and the player works and view in safari and it doesn't with the following error:
Failed to load resource: Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers.
XMLHttpRequest cannot load https://api.soundcloud.com/tracks/266282700?client_id=4949f9f85ff88c4a4d644266e3037754. Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers.
The former example works on Chrome/Firefox because the SDK will transparently follow redirects when present. The /resolve endpoint performs a 302 redirect to a different API url. However, as we've seen with Safari, that doesn't work very well due to some strange CORS behavior. If you use the official SC.resolve function, it has a workaround in place to solve this problem.
I'm not aware of any other SoundCloud API endpoints that need redirects to function, so if you just change that one piece, it should start working. Hope that helps.
Hi @diurnalist, thanks for working on this issue, although the problem still occurs for me.
Loading a track from the SC API into web audio XHR still throws these errors:
[Log] Loading track: https://api.soundcloud.com/tracks/267123288/stream?client_id=7258ff07f16ddd167b55b8f9b9a3ed33 (SoundCloudAPI.js, line 58)
[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (TBBAwaj0kXXn.128.mp3, line 0)
[Error] Failed to load resource: Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers. (TBBAwaj0kXXn.128.mp3, line 0)
[Error] XMLHttpRequest cannot load https://cf-media.sndcdn.com/TBBAwaj0kXXn.128.mp3?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vVEJCQXdhajBrWFhuLjEyOC5tcDMiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE0NjYwNDQyNzN9fX1dfQ__&Signature=vsUqIxWcwg~zVpAdYXswMPGl9degUBP4bRm~fKdd05zH0cIhENm~VkTzgSwtXCiAEtZ-aOOHgDPlGIRjHwOnF0vfo2KYVS5jcMdGy6PpLx9ac9U026ZadeBk791UO~5mgx9hLWHj4U9GuJ5x-7FeoPCSu4wCbs97bB1O6aFGeCLAk6bWyZqbNxHbFQY7D5olyGkRSCl7xRxIHhKDlN2EdXKmWBx69KltyYU1-nyngPiHD2TZgTU7JHYDQTZEccydYcA5Ph8U~1advoVseptLE18SQ7xwH1nFW75FOiKiDbAkkNEdKmNDGETdlBsJL-sxL6ELHh6P7XCHbp2o1OMEyw__&Key-Pair-Id=APKAJAGZ7VMH2PFPW6UQ. Request header field Accept-Encoding is not allowed by Access-Control-Allow-Headers.
@lukephills without more information, such as a reproduction link, I'm afraid I can't diagnose any further. Can you open a new issue if and when you have more info? I'm going to lock this issue for now.
Activity
[-]Can't play sound in Safari OSX[/-][+]Can't play sound in Safari OSX/iOS[/+][-]Can't play sound in Safari OSX/iOS[/-][+]Can't play sound in Safari OSX[/+]patrickjuchli commentedon Oct 29, 2015
The same example is working when using the SDK version 2 (without Promises of course).
jv2222 commentedon Nov 6, 2015
I got the same error. Any ideas on a workaround?
thomasrhiel commentedon Nov 11, 2015
+1
marlenesco commentedon Nov 16, 2015
+1
soundreactor commentedon Nov 29, 2015
+1
soundreactor commentedon Nov 29, 2015
this seems to be a server sided problem. in "Access-Control-Allow-Headers"
Accept-Encoding is missing.
workaround for me was to make a little php proxy and modify the soundcloud sdk 3.0.0:
r = new XMLHttpRequest,
r.open(t, 'https://mrvv.net/beta/proxy.php?url='+n, true), //make your own or use mine for the moment..
Overload119 commentedon Dec 7, 2015
+1
andratwiro commentedon Dec 23, 2015
+1
hiddebraun commentedon Dec 30, 2015
+1
ArthurRougier commentedon Jan 30, 2016
Any news on this one ? @janmonschke maybe ?
heysamtexas commentedon Feb 1, 2016
@soundreactor that is exactly what i did. :-)
karensg commentedon Feb 1, 2016
I am just using the APIs without the Javascript SDK and I have the same bug. This is just a bug in Soundcloud API. How can it be that this bug is there for so long?
lifter035 commentedon Feb 2, 2016
@soundreactor what exactly did you do in your proxy.php? load url as file contents? could you share maybe?
thanks
13 remaining items
andrefelipe commentedon Apr 30, 2016
+1
auggod commentedon Apr 30, 2016
I just set up a gist with my personal solution for this (simple express server + nginx proxy) https://gist.github.com/auggod/019aa5eee8ef618dcf65678e4649d8a7
vojkny commentedon May 10, 2016
+1
lukephills commentedon May 23, 2016
The headers sent using 3.0 sdk sends
http://api.soundcloud.com/resolve?url=someUrl&client_id=?????&format=jsonWhere as the 2.0 sdk sends
http://api.soundcloud.com/resolve?url=someUrl&client_id=?????&format=json&_status_code_map[302]=200Has anyone resolved this without proxying SC requests?
dy commentedon Jun 6, 2016
Oh, I was thinking something is wrong with xhr in safari.
@lukephills thanks for 2.0 sdk url. At least some backend-less workaround.
diurnalist commentedon Jun 9, 2016
👋
I took some time to investigate and fix this today. It will be published in version 3.1.2 of the SDK to both NPM and our connect.soundcloud.com asset hosting domain. I need to work with some others to make sure it goes live.
See #63 for the fix. If anybody has found an official bug report for this behavior in Safari, I'd love to see it. It is a bizarre behavior by the browser, but I wasn't able to find proof of it being recognized as a bug.
diurnalist commentedon Jun 9, 2016
Published as https://connect.soundcloud.com/sdk/sdk-3.1.2.js - I hope this fixes things for you all ❤️
andrefelipe commentedon Jun 9, 2016
Works for me! https://www.anzuclub.com
Thanks!
jv2222 commentedon Jun 9, 2016
Doesn't work for me. Same issue as before. You can see here...
http://techzinglive.com/page/1584/296-tz-discussion-in-the-ether
View in chrome and the player works and view in safari and it doesn't with the following error:
diurnalist commentedon Jun 10, 2016
@jv2222 The reason is that the code on that page does the following:
You should instead change this to:
The former example works on Chrome/Firefox because the SDK will transparently follow redirects when present. The /resolve endpoint performs a 302 redirect to a different API url. However, as we've seen with Safari, that doesn't work very well due to some strange CORS behavior. If you use the official
SC.resolvefunction, it has a workaround in place to solve this problem.I'm not aware of any other SoundCloud API endpoints that need redirects to function, so if you just change that one piece, it should start working. Hope that helps.
lukephills commentedon Jun 16, 2016
Hi @diurnalist, thanks for working on this issue, although the problem still occurs for me.
Loading a track from the SC API into web audio XHR still throws these errors:
jv2222 commentedon Jun 17, 2016
@diurnalist Dude, thanks, you nailed it!
diurnalist commentedon Jun 17, 2016
@lukephills without more information, such as a reproduction link, I'm afraid I can't diagnose any further. Can you open a new issue if and when you have more info? I'm going to lock this issue for now.