Connecting to remote ipfs node

I am trying to connect to a IPFS node using js-ipfs library in nodejs. Initially I was using Infura but it turns out that is does not supports MFS api calls. So my friend decided to spin up his own IPFS node in his laptop. Now I would like to connect to that node so that I can use it as a gateway and upload and download files just like Infura services.

Till now I have tried to connect to his node by using the addresses given in his config file but with no success. I even tried to follow some articles but nothing seems to work. I would be great if I could achieve this. Do let me know if any information is needed.

Could you give a bit more information about your setup please? Are you on the same network/wifi as your friends laptop or are you trying to reach it over the internet? Can you access any other services on it? Can you ping it?

I am trying to reach it over the internet. So when it was not working, we decided to host the IPFS on AWS and check if it is working or not, but till now no success. So is this a valid setup we are trying to do or are we missing something?

Does the port it’s running on appear open to you? E.g. assuming they are runnign the gateway on port 8080 - telnet your-friends-ip 8080

Connecting To x.x.x.x…Could not open connection to the host, on port 8080: Connect failed. But the config file is set so that the gateway is open to all connections. It is ip4/ in the gateway. Am I missing something?

Your friend may need to forward a port on their router to port 8080 on their laptop?

Thank you. Now it is working. But when I tried to call the api from node js using ipfs http client library I get a 404 Not found error.