lludol
lludol

Reputation: 55

nginx with node.js proxy and external api call

I am working on a project where there are two parts:

On my debian server, I have configured nginx like that for the API:

server {
   listen 80;
   return 301 https://$host$request_uri;
}

server {
    listen 443;
    server_name mydomain.com;

    ssl on;
    ssl_certificate /path/to/fullchain.pem;
    ssl_certificate_key /path/to/privkey.pem;
    ssl_session_timeout 5m;
    ssl_protocols SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    ssl_prefer_server_ciphers on;

    location / {
      proxy_pass https://127.0.0.1:3000;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
    }
}

The problem is that the API make some call to the SoundCloud API (api.soundcloud.com).

I think the Nginx server doesn't allow the call and we get in response "Forbidden". The code of API is OK because in my laptop it's working.

Do you have any idea how can I solve it?

EDIT: The javascript (ES6) code (i use node v6.5.0):

const SC = require('soundcloud-node-es6');

SC.init({
    id:     'ID',
    secret: 'SECRET',
});

SC.get('/tracks', {
    q: 'panda',
})
.then((tracks) => console.log(tracks))
.catch((error) => console.log(error));

This code only works "in local". When I run it on my server (with and without nginx), it doesn't work and send me back:

{ code: 403, message: 'Forbidden' }

Upvotes: 1

Views: 1248

Answers (1)

lludol
lludol

Reputation: 55

I found the problem. SoundCloud banned every OVH dedicated server.

From the SoundCloud staff:

Unfortunately, our Trust & Safety engineers needed to block OVH for SoundCloud, as it was causing a lot of spam and fake activity to come through. :-/

More informations here: https://www.soundcloudcommunity.com/soundcloud/topics/403-forbidden-when-using-ovh-vpn

Upvotes: 1

Related Questions