您如何强迫Ngrok转发到HTTP而不是HTTP?

发布于 2025-02-10 04:48:47 字数 255 浏览 2 评论 0原文

Ngrok正在转发给我的HTTPS,当其他服务试图访问端点时,这给我带来了SSL证书错误。

大多数时候,Ngrok向HTTP https转发,但由于某种原因,我的Ngrok仅在使用命令后才转发给HTTPS:ngrok http 4554-host-Host-header = localhost = localhost:4554

如何强制NGROK转发到HTTP而不是HTTP?

ngrok was forwarding to only https for me which was giving an ssl certificate error when other services tried to access the endpoint.

Most of the times ngrok forwards to http and https but for some reason my ngrok was only forwarding to https after using the command: ngrok http 4554 --host-header=localhost:4554

How do I force ngrok to forward to http and not https?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

娇俏 2025-02-17 04:48:48

在3.18.0 ngrok版本上转发到http,使用:

ngrok http --scheme=http 80

To forward to http on 3.18.0 ngrok version use:

ngrok http --scheme=http 80
勿挽旧人 2025-02-17 04:48:48

转发到http:

ngrok http --bind-tls false

转发到https:

ngrok http --bind-tls true

To forward to http:

ngrok http --bind-tls false

To forward to https:

ngrok http --bind-tls true
他是夢罘是命 2025-02-17 04:48:48

如果您在ngrok..yml中使用配置,并且要明确指定一个或多个端点的HTTP协议 - 您可以使用以下方式:

version: "3"
agent:
    authtoken: [your_token]
endpoints:
  - name: mydomain
    url: "http://your_custom_domain.ngrok-free.app"
    upstream:
      url: "http://localhost:8080"
  - name: nodomain
# for the ephemeral domains use simply a schema as below
    url: http:// 
    upstream:
      url: "http://localhost:80"

唯一的是,当您在Ngrok Managed上工作时,大多数现代浏览器都打算从HTTP跳到HTTP域(含义,doemain,由Ngrok提供)。通过对HTTP进行的卷曲检查证明了这是有效的,而浏览器显示错误。

这是官方文件的摘录:

hsts

ngrok的托管域,位于.dev或.app tld上
全球HSTS预加载列表。这意味着ngrok.app上的域,
ngrok.dev,ngrok-free.app等。要求使用https。

ngrok当前仍然允许您使用http创建端点
方案,但是所有现代浏览器都会自动强制使用
相应的HTTPS端点。

如果您需要使用未加密的HTTP方案,则应继续
在ngrok.io基本域上使用域。

原始文本链接

因此,您必须使用自己的自定义域(仅出于测试原因才能非常便宜)。

我希望这会帮助某人。

If you use configuration in ngrok.yml and want to explicitly specify to use HTTP protocol for one or multiple endpoints - you may use this:

version: "3"
agent:
    authtoken: [your_token]
endpoints:
  - name: mydomain
    url: "http://your_custom_domain.ngrok-free.app"
    upstream:
      url: "http://localhost:8080"
  - name: nodomain
# for the ephemeral domains use simply a schema as below
    url: http:// 
    upstream:
      url: "http://localhost:80"

The only thing is that most of modern browsers intend to skip from http to https when you work on ngrok managed domains (means, doemains, provided by ngrok). It is proved by curl check over the http, which works, whereas a browser shows error.

Here is a excerpt form the official documentation:

HSTS

ngrok's managed domains that are on the .dev or .app TLDs are on the
global HSTS preload list. This means that domains on ngrok.app,
ngrok.dev, ngrok-free.app, etc. require the use of HTTPS.

ngrok currently still allows you to create endpoints with an http
scheme, but all modern browsers will automatically force the use of a
corresponding https endpoint.

If you need to use the unencrypted http scheme, you should continue to
use the domains on the ngrok.io base domain.

original text link

Hence, you have to use your own custom domain (you can get one really very cheap for test reasons only).

I hope it will help someone.

黑白记忆 2025-02-17 04:48:47

要转发到HTTP,您需要使用以下方案标志:

ngrok http --scheme=http 4545 --host-header=localhost:4545

这将指定给Ngrok以转发到HTTP,而所产生的端点将是HTTP而不是HTTPS。

To forward to http you need to use the scheme flag as follows:

ngrok http --scheme=http 4545 --host-header=localhost:4545

This will specify to ngrok to forward to http and it the endpoint produced will be http not https.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文