我有一个私人网站internal.mycompany.com
,只能在公司的私人网络中访问。我正在尝试使用 ngrok 使该网站可公开访问。(我购买了一份商业计划书)。无论我尝试什么,我都无法使用 https 打开网站。http 可以正常工作,但并不理想,因为网站通常会将 http 请求重定向到 https。然后我用谷歌尝试了类似的事情。
下面是我的 .ngrok2/ngrok.yml 文件的样子:
http-google-com:
addr: www.google.com:80
host_header: "rewrite"
subdomain: "http-google-com"
proto: http
https-google-com:
addr: www.google.com:443
host_header: "rewrite"
subdomain: "https-google-com"
proto: http
tls-google-com:
addr: www.google.com:443
host_header: "rewrite"
subdomain: "tls-google-com"
proto: tls
然后我运行ngrok start --all
,这些是我用浏览器浏览 url 时每种情况的结果。我的内部网站的所有结果都相同。
http-google-com:当我浏览http://http-google-com.ngrok.io/
(或 https://)浏览器打开时https://www.google.com
。似乎有些重定向。
https-google-com:当我浏览http://https-google-com.ngrok.io/
(或 https://)时,我收到“502 Bad Gateway”错误
tls-google-com:当我浏览浏览器时https://tls-google-com.ngrok.io/
说 ssl 证书适用于“google.com”域而不是“ngrok.io”。添加安全例外后,浏览器显示谷歌的经典 404 页面,上面写着“404。这是一个错误。在此服务器上找不到请求的 URL /。这就是我们所知道的。”
更新
我试过proto:tcp
了,但也没有用。
tcp-google-com:
addr: www.google.com:443
host_header: "rewrite"
subdomain: "tcp-google-com"
proto: tcp