mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #4433] [Feature Request] 希望TCP可以支持hostHeaderRewrite(类似于tcp2https)IP+自签证书情况 #3500
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#3500
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Jenking-Zhang on GitHub (Sep 13, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4433
Describe the feature request
【为什么没有域名,又为什么还要用https】
阿里云 没有“北岸”域名,未本案域名访问会被sni阻断,只能用IP访问,有些服务又只允许使用https链接(比如bitwarden),也不想完全用http裸奔,决定自签IP证书并添加信任来进行自我安慰。
【没有域名只能配tcp代理】
因为没有域名,也就没有子域名(二级域名)用来配https代理的分流,只能配置为tcp代理,frpc的后端是nginx,配置了匹配规则做了限制:不匹配server_name无法访问,只能允许server_name是我配置域名和IP访问。然后发现IP访问会无法,经过半天的测试,发现nginx收到的$host变成了server:0.0.0.0:port了,tcp是点对点的穿透,自然没有$host可以传递。所以希望可以有插件,可以把服务器ip重写为$host。或者https代理能不能增加路径区分的方式来分流。
【其他】
另外用不用备案的机器配置https代理发现了一个问题:一个frpc配置的多个https代理(对应本地多个端口),如:
nginx本地监听了 3000-3002都配置了服务和server_name匹配规则(禁止未匹配的域名访问),也开启了proxy_protocol;。
只能同时访问1个服务,有时候是2个。检查了nginx日志,流量是转发到每个对应nginx监听端口,但是server_name不匹配了,被444拒绝了。断开全部连接之后,就可以访问任意一个,同样的,其他的就又被444了。“也就是三个都能访问,但不能同时访问”
用tcp代理的配置方式:
proxies
name = "Bitwarden-tcp"
type = "tcp"
localIP = "127.0.0.1"
localPort = 3000
remotePort = 3000
transport.useEncryption = true
transport.useCompression = true
transport.proxyProtocolVersion = "v2"
...3001、3002同,略...
所有服务可以同时全部正常访问,真实IP也可以完美传递。问题就是一个服务要对应一个端口。没办法复用443了。所以怀疑https有条多配置的时候,server_name或者host参数传递可能存在问题。但是影响不大,因为配置为https代理的时候,nginx的通配的检测限制可以不要,因为frps的https代理,本身就限制了非指定域名的访问情况
其实写到这儿,自己的思路好像又明白了一点点:用IP访问的情况下,也不需要去匹配是否是IP访问的规则,单开的端口,没有其他方式暴露公网的情况下,因为必然是从服务器传递过去的数据,也不需要去校验,去做限制。一切都交给了frps把关了。
但问题也客观存在,ipv4+ipv6双栈同时开放的情况下,同时需要几种暴露服务的情况方案时(甚至frpc一个服务配多个代理的情况下),很多时候没办法共用一个server块,就要去写不同的服务。
Describe alternatives you've considered
**
3.希望修正一下多个https代理时的包头问题
**
Affected area
@xqzr commented on GitHub (Sep 13, 2024):
1、需要终结 TLS,使用 https2https 插件
https://gofrp.org/zh-cn/docs/reference/client-plugin/#https2httpspluginoptions
2、启动多个 frpc
3、使用 v0.59.0 及以上版本。
@github-actions[bot] commented on GitHub (Oct 5, 2024):
Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
@a1015192905 commented on GitHub (Feb 21, 2025):
我想请教一下IP+自签名证书如何用https代理客户端的nginx服务
@a1015192905 commented on GitHub (Feb 21, 2025):
请问有可以参考的配置方法吗
@Jenking-Zhang commented on GitHub (Feb 23, 2025):
1、使用openssl生成证书,最好是生成根证书,再用根证书生成域名证书,这样可以客户端信任相应的CA就可以了,不然如果存在多个客户端,就要添加信任多个证书。
2、域名证书请求的时候,扩展文件里面附上IP就可以了
3、生成的域名证书当普通证书用就行了~