fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
81.43k stars 12.82k forks source link

局域网内机器自带https服务(非公开认证的ssl证书),frp该怎么配置? #1500

Closed at2008 closed 4 years ago

at2008 commented 4 years ago

使用场景:

局域网电脑部署了Cockpit(一个基于WEB的Linux运维管理工具),在外网通过Cockpit管理局域网的电脑,Cockpit自带https协议,我该怎么配置 frp 才能正常打开Cockpit管理界面呢?

现在 frp 支持的 是https2http,我现在遇到的情况似乎是 http2https 或者 https2https。

现在的问题:

通过配置 frp ,可以在外网打开 Cockpit 登录页面,登陆后就变白屏了,没什么信息显示。

参考信息:

之前用过 花生壳 ,花生壳需要配置一个独立的端口,就通过https从公网访问局域网内https的web应用,不知道花生壳是怎么做的。

What version of frp are you using (./frpc -v or ./frps -v)?

v0.29.1

What operating system and processor architecture are you using (go env)?

ubuntu 18/16

Configures you used:

==============frps=============

frps.ini

[common] bind_port = 11001 kcp_bind_port = 11001 vhost_http_port = 80 vhost_https_port = 443

==============frpc=============

frpc.ini

[common] server_addr = x.x.x.x server_port = 11001 protocol = kcp

[hos-http-m.mydomain.cn] type = http local_port = 9090 custom_domains = m.mydomain.cn

Steps to reproduce the issue: 1. 2. 3.

Describe the results you received:

通过配置 frp ,可以在外网打开 Cockpit 登录页面,登陆后就变白屏了,没什么信息显示。

Describe the results you expected:

希望,通过 frp 能够连接内网已经是https的web应用。

Additional information you deem important (e.g. issue happens only occasionally): 之前用过 花生壳 ,花生壳需要配置一个独立的端口,就通过https从公网访问局域网内https的web应用,不知道花生壳是怎么做的。

Can you point out what caused this issue (optional)

fatedier commented 4 years ago

type = http 改成 type = https。

at2008 commented 4 years ago

type = http 改成 type = https。

大佬,问题依旧

我可能没说清楚,局域网电脑是 https ,公网是 http ,是不是这种方式不可以?

fatedier commented 4 years ago

@at2008 目前不支持,可以考虑在你的 https 所在机器上再部署一个 nginx,通过配置 nginx 可以做这一层转换,再将转换过后的端口通过 http 暴露出来。

fatedier commented 4 years ago

后面也可以考虑一下这个场景吧,可能对调试内部 https 服务有点帮助。

at2008 commented 4 years ago

后面也可以考虑一下这个场景吧,可能对调试内部 https 服务有点帮助。

多谢回复。

fatedier commented 4 years ago

v0.30.0 已新增 https2http plugin。

at2008 commented 4 years ago

@fatedier 感谢!马上测试!

at2008 commented 4 years ago

@fatedier 请问 是 https2http 还是 http2https? 具体如何配置呢?

fatedier commented 4 years ago

https://github.com/fatedier/frp/blob/master/conf/frpc_full.ini#L210 参考这里的配置,上面说错了,是 http2https。

at2008 commented 4 years ago

@fatedier 反馈一下,我用的一个开源运维管理软件 Cockpit,错误提示: Nov 28 19:13:12 CHI-KVM cockpit-tls[1759]: cockpit-tls: gnutls_handshake failed: The TLS connection was non-properly terminated.

fatedier commented 4 years ago

贴下 frpc 日志,另外确认下你的软件能够支持的 TLS 的 version。

at2008 commented 4 years ago

@fatedier

Nov 29 03:32:19 CHI-KVM frpc[9845]: 2019/11/29 03:32:19 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err= Nov 29 03:47:15 CHI-KVM frpc[9845]: 2019/11/29 03:47:15 Unsolicited response received on idle HTTP channel starting with "0\r\n\r\n"; err=

at2008 commented 4 years ago

@fatedier 支持的 TLS version Cockpit supports TLS v. 1.1 and 1.2 by default

fatedier commented 4 years ago

你用 curl 直接请求你的服务,可以得到正常的响应结果吗?

at2008 commented 4 years ago

20191201175320

我不知道你指的是这个吗?

fatedier commented 4 years ago

加上 -k , curl -k https://xxx

at2008 commented 4 years ago

20191201214137

忘记报告一个要点了,通过 frp 登录页面时可以正常打开的,输入登录信息后不能正常进入系统,这个情况不知道怎么怎么测试。上面图时登录页信息,时正常的。

如果可以的的话,大佬自己装个 Cockpit 试试,如果不方便,这个需求应该不普遍的,可暂缓,不要影响主要功能进度。谢谢大佬回复!

maxmib commented 4 years ago

反向https2http也有这个问题,内网是homeassistant http,用frp转换成https外网可以打开登陆页但是登陆不了,一直加载数据,用tcp模式则正常

fatedier commented 4 years ago

有可能是你的网站页面内的链接地址的原因,比如都是 http 的,frp 并不会修改网站中的内容,所以可能的情况就是首页虽然以 https 暴露出去了,但是点击其他链接的时候,还是会访问到 http 的服务,导致访问失败。

yzlnew commented 2 years ago

反向https2http也有这个问题,内网是homeassistant http,用frp转换成https外网可以打开登陆页但是登陆不了,一直加载数据,用tcp模式则正常

也遇到这个问题,最后有解决吗

YumeAyai commented 1 year ago

解决了吗