Mehdi
Mehdi

Reputation: 133

My react app on azure VM does not come up

I have a react.app which I have uploaded the codes to an Azure VM machine on my public subnet. There is no issue with my network and for the purposes of development I have freed all port on security groups an giving them to have no restriction on inbound and outboundport. I have also a load balance which direct the traffic through public subnet. In my load balancer, I have inbound rules to forward for ports 22, and 3000 to the backend pool and VM machine having the react codes. I still can not access my website when I use my public IP of loadbalance along with the port 3000.

The app started on VM but I can not access when in my browser on my PC, I use the 20...92:3000

[root@****i]# npm start
> [email protected] start /var/tmp/thermo-api
> http-server ./app -a 0.0.0.0 -p 3000 -c-1

Starting up http-server, serving ./app
Available on:
  http://127.0.0.1:3000
  http://10.0.1.4:3000
Hit CTRL-C to stop the server

Any clue or help would be appreciated!

EDIT

I can curl inside VM to port 3000 and it gets me to the webpage, but when I ssh to another node in VNET, I can still ping to the VM (10.0.1.4) but I can not curl to port 3000 of my VM.

[AzureUser@***** ~]$ ping 10.0.1.4
PING 10.0.1.4 (10.0.1.4) 56(84) bytes of data.
64 bytes from 10.0.1.4: icmp_seq=1 ttl=64 time=1.67 ms
64 bytes from 10.0.1.4: icmp_seq=2 ttl=64 time=1.95 ms
64 bytes from 10.0.1.4: icmp_seq=3 ttl=64 time=2.07 ms
64 bytes from 10.0.1.4: icmp_seq=4 ttl=64 time=1.70 ms
64 bytes from 10.0.1.4: icmp_seq=5 ttl=64 time=1.78 ms
64 bytes from 10.0.1.4: icmp_seq=6 ttl=64 time=1.65 ms
64 bytes from 10.0.1.4: icmp_seq=7 ttl=64 time=1.78 ms
64 bytes from 10.0.1.4: icmp_seq=8 ttl=64 time=1.76 ms
^C
--- 10.0.1.4 ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 19ms
rtt min/avg/max/mdev = 1.645/1.794/2.069/0.142 ms
[AzureUser@**** ~]$ curl 10.0.1.4:3000
curl: (7) Failed to connect to 10.0.1.4 port 3000: No route to host

I have attached my iptables of the VM here

[root@****]# iptables -L -n -v
Chain INPUT (policy ACCEPT 308K packets, 1658M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 DOCKER-ISOLATION-STAGE-1  all  --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
    0     0 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT 307K packets, 55M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain DOCKER (1 references)
 pkts bytes target     prot opt in     out     source               destination

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DOCKER-ISOLATION-STAGE-2  all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0
    0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DROP       all  --  *      docker0  0.0.0.0/0            0.0.0.0/0
    0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain DOCKER-USER (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

Upvotes: 0

Views: 517

Answers (1)

Nancy Xiong
Nancy Xiong

Reputation: 28224

In this case, I have two points for you.

  • Check if there is any firewall inside the Azure VM. Such as running IPTables on Linux like iptables -L -n -v. Checking the status of IPTables / Firewall. Options “-L” (List ruleset), “-v” (Verbose) and “-n” (Displays in numeric format). You need to open the port 3000 in the VM firewall if there is.
  • For your requirement, you may create an inbound NAT rule of the load balancer. It will look like this. enter image description here

You could follow this guide to troubleshoot Azure Load Balancer. Let me know if you have any questions.

Upvotes: 1

Related Questions