I created a Node.js app (firebase-admin) that reads/writes data from our local SQL Server, reads/writes data to Firebase Realtime Database. This part is working now. My other desktop apps will connect to this Node.js app to request data from firebase RTDB. This part is also working.
I would like now to host the Node.js app in our LAN. How do I setup the host machine so that the desktop apps (also from the same LAN) will connect like http://local ip of host machine/name of app. Example, http://192.168.1.254/firebasemiddleware/. Also, if I have another app, let's say named anothermiddleware, the local address should be, http://192.168.1.254/anothermiddleware/.
This machine is behind a firewall and will not be visible from outside the LAN.
How can I do this?
Thank you.
You could run Nginx as a reverse proxy to pass through based on address to your
multiple local services.
You would setup a reverse proxy on Nginx like this:
location /firebasemiddleware {
proxy_pass http://localhost:3000;
}
location /anothermiddleware {
proxy_pass http://localhost:3001;
}
The docs on this are here
If you're new to this there is a really cool configuration generator by digital ocean that might make life easier for you located here
Your network is currently a local area network and you cannot allow external connections to access it.
Option 1: you find out about the nat of the current carrier that is providing you and open the corresponding port of the nodejs app you are running with nat's port and access it through the public ip, get the public ip by accessing some websites for example: https://whatismyipaddress.com/en-vn/index.
Option 2: simpler if you don't have a static ipv4 address or can't open nat of your carrier, then you can use tunnel, recommend to learn https://www.cloudflare.com/products/tunnel/ .
Related
I'm using NodeJS and Express.js to run my projects.
In local app preview mode, everything works fine. But the ugly, long, and temporary preview link provided on each preview just doesn't cut it for me and I want someone to be able to access my server via:
HTTP://<MY-ELASTIC-IP>:8080
I followed the guide here:
AWS Cloud9 App preview guide
and have my Elastic IP allocated and associated to my EC2 instance running our Cloud9 IDE, I set the inbound security rules as follows:
Inbound rules of my security group for the EC2 instance running our Cloud9 IDE
Then in my NodeJS app I set the listening port to 8080 (as instructed by the guide), and tried all kinds of listening IP addresses (127.0.0.1, 0.0.0.0, (MY-ELASTIC-IP), (MY-PRIVATE-IP)) and tried running the app, hoping I can finally access my server through , but none of them worked.
I'm a seasoned roomie server developer and most of my deployments were through Supervisor, Nginx, Certbot , DNS configuration through my domain registration site, and some router port forwarding and boom my servers would be online in less than 10 minutes.
But really ... what is up with AWS. There's just so much stuff they shoved into this new Cloud9 (I miss the old c9...) and I can't get even the basic stuff done.
What am I missing here? Is there some sort of port forwarding I have to configure between my public elastic IP and my private IPs? I visited most of the similar questions posted about this and still couldn't manage to get my public URL to point to the running NodeJS instance inside C9.
I fought with this forever and finally got access by using listening address '0.0.0.0' and constructed the url using the IPv4 Public IP listed in "Manage EC2 Instance": HTTP://:8080
Not ideal because this Public IP changes each time I launch the environment but solved my immediate problem
I am working on a swift project for osx with Firebase. I have a node web server to communicate between the clients and the Firebase-server, but it's a localhost-server. Do I need a real domain name to make the server accessible to end-users on another device? (I don't want a web app, just the backend for myself)
you doesn't need a domain .. but you need a serve to deploy having ip address .. suggestion you can use cloud server
You have two ways:
make request on port that the nodejs uses, example http://101.01.01.01:8000
use nginx like proxy, in this setup make your requests on 80 port (it's default), example http://101.01.01.01.
If you wont make something like dev environment on local machine use first case (don't forgot open port for other devices), for production - second.
I have spent whole day looking for an answer why my node js app is not reachable from the internet when I run it on Kubernetes with loadbalancer as a service type. The solution was to change host from localhost to 0.0.0.0 in node js server app definition, but I still don’t know why?
I hope this saves one’s time in the future.
When you say that you set the host I guess you mean what the app is told to listen on in the listen function like express app server . listen all intefaces instead of localhost only You can bind to a particular address or leave it open to all by using the 0.0.0.0 mask (the zeros function as a mask for matching rather than a true IP address - https://stackoverflow.com/a/20778887/9705485).
I imagine you had your app running fine locally and were able to access it from your host machine with your localhost configuration. This would be because your local machine would be accessing it in a way that conforms to the mask. Your config was effectively saying only localhost can access this app. So when you ported to Kubernetes then your machine has to go over a network and the incoming connection was then your machine's external/public IP address, which then did not match the localhost mask. So to get it to work you changed the mask to make it open to all IPs.
I've made a simple Node.js app that i can host locally and using services like evennode. Now I want to do this on my home PC and it seems like a simple task to do - just port forward and get a domain name.
However, my problem is that i don't have a public IP. My ISP uses private/dynamic IP addresses which makes hosting impossible(?).
Is there a program or service that can fix my problem? I've found some for Apache/SQL servers but nothing for Node.js
I am trying to build a local test environment where my local devices will point to a different environment than production. The easiest way for me to do this is to point the device to a server that will map all routes to the production endpoint, to the staging endpoint.
How can I point my router to a Node.js instance, and use the Node.js instance as the DNS server?
It sounds like you're basically wanting to set up a (temporary?) alias for a host name on your local network so that all devices on your network use that alias. For example, today I might want to go to http://application.example.com and access the development version; tomorrow I will want to go to the same address and access the testing version.
There are a couple of different ways to do this:
Add a proxy - this will take HTTP requests for one host and route them to a different host. You could do this with a virtual machine, a Docker container, or directly on the development/testing machine. All you need to do is point your application domain at the proxy and configure the proxy to send the requests to the server you want.
Configure your router to serve the test environment IP address - some routers permit you to add host names to the DNS configuration. This would allow you to simply switch the IP address for the test and development environments as needed, while keeping the same host name.
Add a DNS server to your local network - this is basically the same as the item above, except that it gives you much more control (and is more difficult to configure).
All of these will take some work to set up and will depend very much on your server and network setup.