Restivus external api not accessible from another pc

When running the external api in local host it works fine, But trying with another host on my network I’m not gettting anything. Give a solution.

var Api = new Restivus({
useDefaultAuth: false,
prettyJson: true,
enableCors: true,
defaultHeaders: {
‘Access-Control-Allow-Origin’: ‘’,
‘Access-Control-Allow-Headers’: ‘Origin, X-Requested-With, Content-Type, Accept, Z-Key, x-user-id,x-auth-token’,
‘Access-Control-Allow-Methods’: ‘GET, POST, PUT, DELETE, OPTIONS’,
‘Content-Type’: ‘application/json’
},
defaultOptionsEndpoint: function() {
this.response.writeHead(201, {
‘Access-Control-Allow-Origin’: '
’,
‘Access-Control-Allow-Headers’: ‘Origin, X-Requested-With, Content-Type, Accept, Z-Key’,
‘Content-Type’: ‘application/json’,
‘Access-Control-Allow-Methods’: ‘GET, POST, PUT, DELETE, OPTIONS’,
});
}
});

Api.addRoute(‘articles/’, {authRequired: false}, {
get: function () {
console.log(‘executed’)
return Meteor.users.find().fetch();
}

my api: http://192.168.1.153:3000/api/articles
I just hit the api in my crome browser. Any help would be appreciated

Can you access a regular webpage from another PC? Would be good to isolate the issue to Restivus

1 Like

yes, I can. Even in my pc when i hit this api i can see the data from meteor.users collection. But when I try with another pc it not giving any resposes

I’m not certain, but it might be worth looking into CORS

It’s possible that you need to enable access from other domains.

1 Like

Yeah…just testing it

Thank you it was my firewall blcoking it.

Glad you got it sorted