How to expose my angular 4 to internet using ngrok? - node.js

i have an angular app running on localhost with port 80, when i use ngrok http 80 command it shows invalid host header. how to use ngrok to work with my angular 4?

if your local angular webapp runs at port 80, run:
ngrok http --host-header=rewrite 80
Note: ngrok should be added to your PATH

I have managed to to solve this by running my angular app like this ng serve --disable-host-check this should work for you

Related

Getting REACT App running on port 3001 to show on AWS EC2 Http port 80

I deployed a REACT application on an AWS EC2 running Ubuntu by cloning my github repository and installing node and npm. I tried running the application after installing all of the dependencies and it finally says:
Project is running at http://localhost:3001/
How do I make the running project show up on the http(80) port of the EC2?
Inbound ports open: 80, 443 and 22.
Please install nginx on your EC2 instance which will serve your frontend.
Follow the below blog for steps
https://dev.to/xarala221/the-easiest-way-to-deploy-a-react-web-application-2l8a
Thanks

How to access AngularJS application on Azure Virtual Machine?

I've both NodeJS and AngularJS applications. I'm using npm install to download the app's dependencies for both the application. The NodeJS application runs on port 4000 and AngularJS application runs on port 4200. I can access APIs from NodeJS application in the browser and cannot access the application's UI(AngularJS) in the browser. I have deployed these applications on Azure Virtual Machine.
I have opened the ports 4000 and 4200 in the network settings of Azure VM. I'm using npm start command to start both the applications. NodeJS working fine as like in the local machine but not the same case with AngularJS. There is no errors or warnings from AngularJS side. It shows that the app is listening on http://localhost:4200/ and it is not accessible.
In this case, you need to run ng serve --host 0.0.0.0 to allow that your AngularJS application is listening on 0.0.0.0 for outside connecting. You could refer to this How to allow access outside localhost
Try using:
ng serve --open --host 0.0.0.0 --disable-host-check

How to bind port 4200 (Angular web server) to port 80 (Apache web server)?

I have Apache Web Server running on EC2 (RHEL 7) on port 80.
Also have Angular App running on port 4200 on the same server.
How to bind port 80 so that when someone from outside goes to IP (e.g. 1.2.3.4) goes directly to Apache port 80 (that part works now) which then redirect (or bind) to port 4200 so that the end user can see Angular app output (instead of Apache output)?
Thanks.
Use a reverse proxy Nginx for example.
The step will be the following: Nginx listens 80 port from outside and passes this request to 4200 to your Angular app.
Why do you use apache on this port? And what does apache do?
You should instead like Red Cricket says follow the docs.
First run ng build prod or whatever build you need.
Then add the .htaccess file with redirect rules into your dist folder and place it wherever your apache will serve the angular app.
For extra details see the link provided by Red Cricket.

how to connect an angular app on public ip to a node app on local server?

I have an angular 4 and a node app. I connect them with HTTP services. now I put them on a local server with 192.168.x.y IP. I start my angular app by:
ng serve --port 8080 --host 192.168.x.y --public 151.233.t.z which 151.233.t.z is my public IP. and finally, I run my apps by: pm2 start npm -- start and pm2 start index.js.(my node server is listening on port 3000) and in the HTTP services I send my HTTP request to http://192.168.x.y:3000. when I open the browser on 151.233.t.z:8080 on a local system everything is ok. but when I try outside the network I just can see my angular app and when I click on a button to send post request for login, it's not working!

nodejs http-server, can't connect localhost

I am using nodejs http-server for a web application. I am able to launch the http-server by running nom start. I can access my server through http://127.0.0.1:8080 but I can't connect by http://localhost:8080. I have checked that localhost can be ping from my terminal and localhost works fine with other server such as tomcat. So I think the problem relates to http-server only. Is there any configuration I need to setup on my application in order to support localhost access?

Resources