跳到主要内容

HTTPS

通过域名将内网服务暴露到公网。服务端需开启域名入口,见 域名

domains 必填且非空:可写完整域名(如 web.example.com),或无 . 的短前缀(如 web,需服务端 rootDomain)。不支持通配符。

两种模式:

  • 透传:按 SNI 转发,证书在内网 HTTPS 服务上
  • TLS 终止:客户端插件 tls-term 终止 TLS,再转发到本地 HTTP服务

示例:透传

服务端:

# orbien-server.toml
listen = "0.0.0.0:9527"
httpsGwPort = 443

客户端:

# orbien.toml
server = "YOUR_SERVER_IP:9527"

[[tunnels]]
name = "web-ssl"
protocol = "https"
service = "127.0.0.1:443"
domains = ["web.example.com"]

web.example.com 解析到服务端 IP 后访问:

curl https://web.example.com

示例:TLS 终止

客户端终止 TLS,后端只需提供 HTTP:

# orbien.toml
server = "YOUR_SERVER_IP:9527"

[[tunnels]]
name = "https-term"
protocol = "https"
domains = ["web.example.com"]

[tunnels.plugin]
type = "tls-term"
service = "127.0.0.1:80"
certFile = "/path/to/cert.pem"
keyFile = "/path/to/key.pem"

certFile / keyFile 可省略,省略时使用临时自签证书(浏览器会提示不受信任)。启用插件后使用 plugin.service 指向本地 HTTP,不再使用隧道级 service,且不可配置 PROXY Protocol。

示例:TLS 终止时改写 Host

tls-term 下,转发到本地 HTTP 前改写 Host

[[tunnels]]
name = "https-term"
protocol = "https"
domains = ["web.example.com"]

[tunnels.plugin]
type = "tls-term"
service = "127.0.0.1:80"
certFile = "/path/to/cert.pem"
keyFile = "/path/to/key.pem"
hostHeaderRewrite = "127.0.0.1"

参数

参数必填默认值说明
name隧道名称,唯一
protocol固定为 https
service条件本地服务地址(透传必填),如 127.0.0.1:443
domains域名列表,至少一个;完整域名或无 . 的前缀(前缀需服务端 rootDomain
plugin.typetls-term:客户端终止 TLS
plugin.service条件tls-term 时必填,如 127.0.0.1:80
plugin.certFile证书路径;空则临时自签
plugin.keyFile私钥路径;空则临时自签
plugin.hostHeaderRewrite改写转发到本地服务的 Host;空表示不改
transport.bandwidth0带宽上限(Mbps);0 表示不限制
transport.bandwidthLimitSideclient限速端:client / server
transport.proxyProtocolVersionPROXY Protocol:v1 / v2tls-term 不可用)