Problem with HTTP redirects

If I try this:

    var webpageRaw = HTTP.call('GET', url, {
      encoding: null, // get content as binary data
      responseType: 'buffer', // get it as a buffer
      followRedirects: true
    });

with url set to http://www.soundcloud.com, then I get the following error:

Error: failed [400] Response is not of type String

This is because SoundCloud redirects to https://soundcloud.com and this redirect is not followed, although I’ve added the followRedirects option (just to be sure it’s set). With other (non-redirecting) URLs, the code works fine.

Any ideas why the redirect does not take place?

Hey @waldgeist

Were you able to figure out this issue. I am also having a similar problem where my payment gateway is sending a redirect on Http Post call but the redirect is not followed even when “followRedirects: true” option is set.

Thanks

I digged through my code, since I am not sure anymore how I solved this in the end. But I found out that I eventually set a header:

    var webpageRaw = HTTP.call('GET', url, {
      encoding: null, // get content as binary data
      responseType: 'buffer', // get it as a buffer
      headers: {
        'User-Agent': 'Mozilla/5.0 Chrome Safari'
      }
    });

Maybe this was related to it. Could be that the server checked which agent was accessing and just sent an “unsupported browser” message.