Run nodejs app through HTTPS - node.js

I have a node app that is setup on SSH by running node osjs run --hostname=dc-619670cb94e6.vtxfactory.org --port=4100.
It starts at http://dc-619670cb94e6.vtxfactory.org:4100/ without problems, but instead I want to serve it through HTTPS https://dc-619670cb94e6.vtxfactory.org:4100/ , where I receive an error ERR_CONNECTION_CLOSED.
If I use the port I'm unable to reach it with https, but https://dc-619670cb94e6.vtxfactory.org/ is accessible.
How can I serve the port 4100 through htttps?
Thanks.

This is an implementation detail of OS.js. Their docs recommend setting up a reverse proxy for servers. Doing this will give you more control over SSL and ports, like you want
https://manual.os-js.org/installation/

Related

ng serve | Will not cast to ther devices

I run my app to my local machine via ssl like this:
ng serve --ssl --host: 0.0.0.0
so it is up at: https://localhost:4200
I also using my ipv4 adress which is: XXX.XXX.XX.XXX to make my requests to the server via my services, so i make my api calls like this: https://XXX.XXX.XX.XXX:80/api...
In my back end, I have created an https server so my API calls are been made via https
Everything works great to my desktop
Problem is: The app wont cast to ther devices.. it wont even load and
after some time i get the msg this site cannot be reached
The built in webpack server that is used for ng serve is not meant for production or sharing to other computers, it is only supposed to work on local for development because of security reasons. You should consider hosting a compiled version with a separate web server such as nginx. If you absolutely NEED the built in webpack one to work, you can force it to bind to all of your IP addresses with this:
ng serve --host 0.0.0.0
You may need to disable the host check as well:
ng serve --host 0.0.0.0 --disable-host-check
You can access this, but you might need to turn off your Firewall, this mostly happens in windows machines.
Try turning it off and accessing the IP from other machine.

Running both Node.js and Apache on the same domain and "URL"

Is it possible to run Both node and Apache on the same domain without adding the port in the URL ?
and serve both on the same page, i already have node running on port 8443 and Apache on port 433 and they both work fine but i need to specify in the link the port "8443" to access node which is not what i want,
i want to serve both on the same URL if possible without adding the port to the URL.
You can use Apache reverse proxy
Add this configuration to your apache conf.
ProxyPass "/nodeapp" "http:/localhost:8443"
You can access node application by http://www.example.com/nodeapp
A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from server. These resources are then returned to the client as if they originated from the web server itself.
You can set an nginx proxy before them and separate routes to apache or node.
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

Node not working properly

any ideia why my node only runs in http? The node keeps running but if you put https in browser the node will not work properly, as it only works properly on http,
Configuring Nginx and SSL with Node.js for HTTPS
Please go through the below link and follow all steps
Link
Note: It is mandatory to have Domain Name forwarding request to your working Node IP Address

Running Node App on Shared Hosting (It's almost working)

I've managed to get Node and NPM installed on my shared hosting account with Namecheap by following this answer. It all seems to be working, I can launch my app and it stays launched, but the subdomain which points to app's root route just shows up the folder of the domain.
I've tried going to myaddress.com/subdomain:8080 but I get a server error plus a 404. I've also tried changing Node's listening port from 8080 to 80, but on 80 I get an error:
Error: listen EACCES 0.0.0.0:80
So that means I don't have rights to port 80. How can I get clients to connect port 8080?
This is the part that shared hosting has a problem with, they wont open any ports for you. This is exactly where your workaround needs to be centered. Im currently looking for solutions to either use php to serve a node
see here https://www.npmjs.com/package/node-php-server
and here How to host a Node.Js application in shared hosting
or just configuring express to use somehow port 80.
These would be your best options.

setting up nodejs on sharing host

how setting up nodejs on sharing host?
nodejs and git installed on my host and I access to ssh , but when I want to run my application , apache handle those routes.
I read some article but those said fix with httpd.conf and I don't access to httpd.conf
If you have the proper permissions you can forward all the traffic from port 80 that apache handles to the port that your node app is running. You can find examples on google if you search for keywords like apache, vhosts and reverse proxy.

Resources