Exposing the localhost to the world always gives 5** [ngrok, localtunnel, etc]

720 Views Asked by At

I have a React JS app that started with a local server using the command: react-scripts start:

Compiled successfully!

You can now view telco-widget in the browser.

  Local:            http://localhost:3000/
  On Your Network:  http://192.168.0.117:3000/

Note that the development build is not optimized.
To create a production build, use yarn build.

I want to expose the localhost to the world, so I've tried ngrok:

ngrok http 3000

which gives the valid output:

Session Status                online                                                                                                        
Account                       xxx (Plan: Free)                                                                                              
Version                       2.3.35                                                                                                        
Region                        Europe (eu)                                                                                                   
Web Interface                 http://127.0.0.1:4040                                                                                         
Forwarding                    http://xxx.eu.ngrok.io -> http://localhost:3000                                                      
Forwarding                    https://xxx.eu.ngrok.io -> http://localhost:3000                                                     
                                                                                                                                            
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                   
                              0       0       0.00    0.00    0.00    0.00 

but once I try to reach the https://xxx.eu.ngrok.io I see an error:

enter image description here

I also tried:

  • ngrok alternatives like localtunnel but the result is similar: 504 error
  • changing the port for the webserver
  • serving local directories with ngrok (working well: ngrok http file:///Users/me/share) instead of localhost
  • using clean etc/hosts

Versions of the tools:

  • react-scripts - 3.1.2
  • yarn - 1.22.4
  • ngrok - 2.3.35
  • localtunnel - 2.0.0
1

There are 1 best solutions below

1
On

Dude! your web server is not running.

Make sure your server is running and try to open link localhost:3000 in browser. then let me know if still you've any issue.