[GH-ISSUE #628] 【frp-0.14.1】两个子域名和两个服务不能一对一的正确访问 #489

Closed
opened 2026-05-05 12:19:04 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @Jonkimi on GitHub (Jan 29, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/628

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.
(为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。)

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
frps 和frpc的版本都是0.14.1

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/lib/golang"
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build719236514=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2

Configures you used:

在云服务器上部署frps和blog服务,在内网机器上部署gitlab服务。
实现最后能使用两个子域名分别访问两个服务。

frps配置

[common]
bind_port = 7000
vhost_https_port = 443
privilege_mode = true
privilege_token = password
privilege_allow_ports = 7000-8000
subdomain_host = example.com
log_level = trace

frpc配置1--blog服务

[common]
server_addr = *.*.*.*
server_port = 7000
privilege_token = password

[web_blog]
type = https
local_ip = 127.0.0.1
local_port = 8443
subdomain = blog

frpc配置2--gitlab服务

[common]
server_addr = *.*.*.*
server_port = 7000
privilege_token = password

[web]
type = https
local_port = 443 
subdomain = gitlab

[ssh]
type = tcp 
local_ip = 127.0.0.1
local_port = 22
remote_port = 8001

nginx配置

server {
        listen       8443 ssl http2;
        server_name  blog.example.com;
        ssl          on;
        root   /usr/share/nginx/html;
        index index.html;
}

Steps to reproduce the issue:

  1. frps服务和frpc配置1的blog部署在阿里云机器上,frpc配置2的gitlab部署在内网机器上;
  2. 启动blog服务,不启动gitlab服务,启动frps和两个frpc;
  3. 浏览器中访问gitlab.example.com。

Describe the results you received:
访问gitlab.example.com实际上访问的是blog服务。

Describe the results you expected:
github.example.com应该无法访问。
Additional information you deem important (e.g. issue happens only occasionally):

  1. 当blog不启动,gitlab启动时,gitlab.example.com访问gitlab服务,blog.example.com不能正常访问,正常;
  2. 当两个服务都启动时,如果blog服务先启动,gitlab.example.com访问blog服务,如果gitlab服务先启动,两个域名都能正常访问。

Can you point out what caused this issue (optional)

Originally created by @Jonkimi on GitHub (Jan 29, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/628 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. (为了节约时间,提高处理问题的效率,不按照格式填写的 issue 将会直接关闭。) Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** frps 和frpc的版本都是0.14.1 **What operating system and processor architecture are you using (`go env`)?** ```shell GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/root/go" GORACE="" GOROOT="/usr/lib/golang" GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build719236514=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2 ``` **Configures you used:** **在云服务器上部署frps和blog服务,在内网机器上部署gitlab服务。** 实现最后能使用两个子域名分别访问两个服务。 frps配置 ```ini [common] bind_port = 7000 vhost_https_port = 443 privilege_mode = true privilege_token = password privilege_allow_ports = 7000-8000 subdomain_host = example.com log_level = trace ``` frpc配置1--blog服务 ```ini [common] server_addr = *.*.*.* server_port = 7000 privilege_token = password [web_blog] type = https local_ip = 127.0.0.1 local_port = 8443 subdomain = blog ``` frpc配置2--gitlab服务 ```ini [common] server_addr = *.*.*.* server_port = 7000 privilege_token = password [web] type = https local_port = 443 subdomain = gitlab [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 8001 ``` nginx配置 ```ini server { listen 8443 ssl http2; server_name blog.example.com; ssl on; root /usr/share/nginx/html; index index.html; } ``` **Steps to reproduce the issue:** 1. frps服务和frpc配置1的blog部署在阿里云机器上,frpc配置2的gitlab部署在内网机器上; 2. 启动blog服务,不启动gitlab服务,启动frps和两个frpc; 3. 浏览器中访问gitlab.example.com。 **Describe the results you received:** 访问gitlab.example.com实际上访问的是blog服务。 **Describe the results you expected:** github.example.com应该无法访问。 **Additional information you deem important (e.g. issue happens only occasionally):** 1. 当blog不启动,gitlab启动时,gitlab.example.com访问gitlab服务,blog.example.com不能正常访问,正常; 2. 当两个服务都启动时,如果blog服务先启动,gitlab.example.com访问blog服务,如果gitlab服务先启动,两个域名都能正常访问。 **Can you point out what caused this issue (optional)**
gitea-mirror 2026-05-05 12:19:04 -06:00
Author
Owner

@fatedier commented on GitHub (Feb 26, 2018):

本地无法复现,建议更新到最新版本再测试下吧。

<!-- gh-comment-id:368523587 --> @fatedier commented on GitHub (Feb 26, 2018): 本地无法复现,建议更新到最新版本再测试下吧。
Author
Owner

@Jonkimi commented on GitHub (Feb 27, 2018):

更新到最新版本重新测试后发现是谷歌浏览器的问题。IE上测试访问均正常,火狐Ctrl+F5强制刷新后域名可正常对应服务,谷歌浏览器基本没戏。

<!-- gh-comment-id:368808935 --> @Jonkimi commented on GitHub (Feb 27, 2018): 更新到最新版本重新测试后发现是谷歌浏览器的问题。IE上测试访问均正常,火狐Ctrl+F5强制刷新后域名可正常对应服务,谷歌浏览器基本没戏。
Author
Owner

@notedit commented on GitHub (Mar 19, 2018):

我也遇到类似的问题 多个子域名访问对不上 访问 a.xxx.net 有时候会出现 b.xxx.net 的内容

<!-- gh-comment-id:374208809 --> @notedit commented on GitHub (Mar 19, 2018): 我也遇到类似的问题 多个子域名访问对不上 访问 a.xxx.net 有时候会出现 b.xxx.net 的内容
Author
Owner

@Jonkimi commented on GitHub (Mar 14, 2019):

@fatedier 我的网站都是使用的 HTTP2,而 HTTP2 有多路复用,通过抓包,相同IP不同域名浏览器使用了同一个 TCP 连接,应该是 frp 不支持 HTTP2。(frp-0.25.0 目前测试结果一样)

<!-- gh-comment-id:472822299 --> @Jonkimi commented on GitHub (Mar 14, 2019): @fatedier 我的网站都是使用的 HTTP2,而 HTTP2 有多路复用,通过抓包,相同IP不同域名浏览器使用了同一个 TCP 连接,应该是 frp 不支持 HTTP2。(frp-0.25.0 目前测试结果一样)
Author
Owner

@Jonkimi commented on GitHub (Mar 14, 2019):

发现和 #913 问题相同

<!-- gh-comment-id:472829469 --> @Jonkimi commented on GitHub (Mar 14, 2019): 发现和 #913 问题相同
Author
Owner

@Jonkimi commented on GitHub (Mar 15, 2019):

查阅到的连接复用相关资料 Connection ReuseHow Connection Reuse works on multiple browsers

我的网站使用的是同一个通配域名证书,都配置了 HTTP2,符合 rfc7540 里所说的 reuse 情况。

找到的解决方法: if you do not want connection sharing to happen, have a different IP address and/or ensure no overlaps in certificates, 我把通配域名证书改成单域名证书问题解决,非 frp 的问题。

<!-- gh-comment-id:473147400 --> @Jonkimi commented on GitHub (Mar 15, 2019): 查阅到的**连接复用**相关资料 [Connection Reuse](https://httpwg.org/specs/rfc7540.html#reuse),[How Connection Reuse works on multiple browsers](https://daniel.haxx.se/blog/2016/08/18/http2-connection-coalescing/)。 我的网站使用的是同一个通配域名证书,都配置了 HTTP2,符合 rfc7540 里所说的 reuse 情况。 找到的解决方法:[ if you do not want connection sharing to happen, have a different IP address and/or ensure no overlaps in certificates](https://stackoverflow.com/questions/41785803/http2-the-421-misdirected-request-status-code-example), 我把通配域名证书改成单域名证书问题解决,非 frp 的问题。
Author
Owner

@ax2009live commented on GitHub (May 18, 2021):

查阅到的连接复用相关资料 Connection ResuseHow Connection Resuse works on multiple browsers

我的网站使用的是同一个通配域名证书,都配置了 HTTP2,符合 rfc7540 里所说的 reuse 情况。

找到的解决方法: if you do not want connection sharing to happen, have a different IP address and/or ensure no overlaps in certificates, 我把通配域名证书改成单域名证书问题解决,非 frp 的问题。

果然,按照您说的,把通配域名证书改成单域名证书,问题就解决了,解决困扰了我很久的问题,非常感谢!

<!-- gh-comment-id:843324697 --> @ax2009live commented on GitHub (May 18, 2021): > > > 查阅到的**连接复用**相关资料 [Connection Resuse](https://httpwg.org/specs/rfc7540.html#reuse),[How Connection Resuse works on multiple browsers](https://daniel.haxx.se/blog/2016/08/18/http2-connection-coalescing/)。 > > 我的网站使用的是同一个通配域名证书,都配置了 HTTP2,符合 rfc7540 里所说的 reuse 情况。 > > 找到的解决方法:[ if you do not want connection sharing to happen, have a different IP address and/or ensure no overlaps in certificates](https://stackoverflow.com/questions/41785803/http2-the-421-misdirected-request-status-code-example), 我把通配域名证书改成单域名证书问题解决,非 frp 的问题。 果然,按照您说的,把通配域名证书改成单域名证书,问题就解决了,解决困扰了我很久的问题,非常感谢!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#489
No description provided.