【发布时间】:2021-01-26 17:59:09
【问题描述】:
我有一个使用以下命令从本地服务器启动的 React JS 应用程序: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.
我想向世界公开本地主机,所以我尝试了ngrok:
ngrok http 3000
给出有效输出:
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
但是一旦我尝试访问https://xxx.eu.ngrok.io,我就会看到一个错误:
我也试过了:
-
ngrok替代品如localtunnel但结果相似:504 错误 - 更改网络服务器的端口
- 使用
ngrok(运行良好:ngrok http file:///Users/me/share)而不是 localhost 为本地目录提供服务 - 使用干净的
etc/hosts
工具的版本:
- 反应脚本 - 3.1.2
- 纱线 - 1.22.4
- ngrok - 2.3.35
- localtunnel - 2.0.0
【问题讨论】:
标签: localhost webserver ngrok tunnel localtunnel