Problem when getting HTTPS URL via HTTP package [Solved]


#1

If I execute this:

HTTP.call('GET', 'https://soundcloud.com/');

I only get an exception:

[Error: failed [400] <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><link rel="dns-prefetch" href="//style.sndcdn.com"><link rel="dns-prefetch" href="//a-v2.sndcdn.com"><link rel="dns-prefetch" href="//api-v2.soundcloud.com"><link rel="dns-prefetch" href="//sb.scorecardresearch.com"><link rel="dns-prefetch" href="//secure.quantserve.com"><link rel="dns-prefetch" href="//eventlogger.soundcloud.com"><link rel="dns-prefetch" href="//api.soundclou...] stack: [Getter]

If I try the same request using https://www.hurl.it/, everything works fine, there I can see a valid 200 response. So the server seems to react correctly, but the GET method of Meteor’s HTTP package fails.

Any ideas why this is not working with HTTP.get()?


#2

Found the solution: SoundCloud is using user agent detection and sends a 400 error response if the browser does not match its expectations.