Nodejs get/post requests randomly time out from same network - node.js

I've written a nodejs server to respond to get/post requests and an angular app that is hosted through the node server. When I access the api in any way from the same network (through postman, a browser, or the angular app) it randomly times out or sometimes works. However, from a different network the get and post requests ALWAYS work immediately. It is worth noting that I am using my public IP to make these get/posts requests. If I use my local IP from the same network it works as expected.
Not sure what is going on here, any help would be appreciated.

Related

How to not show PORT from Nodejs API Requests

I was working in a project and sudden noticed that while react is calling node api, i can see port number also in console network, which i think is not secure.
So is there any tool, settings whcih we can use to hide ports from api calls.
I am using apache as server, node api and react frontend.
Thanks
Tried virtual host settings but not worked

Remote URL resolves when server is running locally but times out in production (heroku server)

This url https://prodimage.images-bn.com/pimages/2940161410400_p0_v1_s550x406.jpg resolves locally but not in production (heroku server) (NodeJS express). I even tried routing through a proxy and again it resolves locally but times out on the server. I am just making a simple axios get request, I've also tried node-fetch and other libraries with no success. I even tried to switch my hosting provider to vercel and the behavior was the same. Very odd. I'm wondering if anyone has an explanation for why that is and if there is a work around that could be done to be able to fetch from that domain on my server.

Get db results from (node - express - mongodb) to angular 4 securely

There is no issue b/w establishing connection b/w nodejs & angular. Also the database results are fine. This is the only problem I'm facing now.
I have 2 different ports but same server
0.0.0.0:3000 - for nodejs
0.0.0.0:4200 - for angular
When I make an api request to node(mongodb) from angular it is visible in browser console as well as networks tab when I inpect. How can I overcome this ?
You can't. Angular is an SPA, a framework that works on front-end. Which means once the files of the application downloaded in the browser memory, it then launch the instance of your application.
Afterwhat, when you make a request to an API or any other URL, the browser behaves as it should : it makes the request. You have no real way to prevent this.
That doesn't mean the requests are not secure. Viewing requests made by your app in the console or the network tab doesn't mean it's not secure.
you can use nginx as a proxy server to redirect your all REST call to overcome this.
for detailed use please visit here nginx

axios.post gives error on my VPS when sending post request locally to another app. Everything works fine on my local computer

So I have a Nginx configured to forward requests trough port 433 (SSL) to localhost:3000 where react is running, react shall in turn post requests to a Node.js app running on the same VPS (localhost:8080) to make a stripe payment.
Everything work fine so far. The frontend is rendering, SSL working.
But when the i run axios.post with the payment data from React it never reaches the Node (as far as my logs tell me).
I have CORS setup in node to accept a bunch of "localhost" variants and the actual domain itself.
Why is this not working?
Thanks!
I should have been poitning the React app to the Url of the api, not its local adress on my VPS sorry.

Node express from webserver

I have been developing a standalone app for an event exhibition. This comprised of a backbonejs frontend with a node express server backend for saving data. At the event this will run over localhost fine but how can I make the express server be accessed via normal http. I.e the backend responds when app is added to my webserver for client review
Any ideas.
G
Servers available at localhost should respond to http requests if your firewall is open. If you are behind a router, you need to configure it to forward requests to your machine. NAT is the simplest (and least safe) way.

Resources