ngrok-获取到本地服务器的所有路由 [英] ngrok - Get all routes to localhost server

查看:300
本文介绍了ngrok-获取到本地服务器的所有路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地主机中使用ngrok(免费帐户)来编写用Go语言编写的编码Web服务器

I'm using ngrok (free account) in my localhost for my coded web server written in Go

在Ubuntu中,启动服务器(侦听端口3000)后,我运行以下命令来启动ngrok:

In Ubuntu, after starting my server (which listens on port 3000), I run this command to start ngrok:

./ngrok http 3000

然后另一台PC可以通过ngrok提供的路径访问我的演示网站,例如http://6fed323a.ngrok.io

Then other PC can get access to my demo web by path provided by ngrok, for instance, http://6fed323a.ngrok.io

但是当他们在上面做某事(例如,单击重定向按钮)时,URL的主机再次变为localhost

But when they do something on it (for example, click on a button that redirects), the host of URL becomes localhost again

ngrok没有任何功能可以访问服务器中的所有路由,是吗?我正在学习

There isn't any functions of ngrok that allows access to all routes in server, is there? I'm learning

推荐答案

当我在使用Rails应用程序时,我想在 ngrok 上运行它,但是在下面出现错误:

While I was working on a Rails app I wanted to run it on ngrok but I got error below:

The connection to http://xxxxxx.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:3000.

似乎ngrok可以正常工作,但我的本地服务器却不能.这是正确的,因为我忘记先运行$ rails s来运行我的rails应用程序.这样,我就可以很好地进行ngrok调整.

It seems like ngrok works fine but my local server is not. Which is true since I forgot to run my rails app first by run $ rails s. By doing so I was able to get ngrok tunneing works fine.

确保首先运行本地服务器.

Make sure your local server run first.

当我单击在route file中定义为root_path的站点徽标时,我注意到ngrok url更改为localhost url.但是其他链接和标题标签也可以正常工作,并显示ngrok网址.

I have noticed ngrok url changes to localhost url when I click on site logo which is defined as root_path in my route file. But other links and header tabs for example works fine and shows ngrok url.

祝你好运.

这篇关于ngrok-获取到本地服务器的所有路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆