[GH-ISSUE #4278] frp返回错误的页面,访问不同子域名时返回错误页面 #3375

Closed
opened 2026-05-05 14:10:32 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @zackeryyy00 on GitHub (Jun 13, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4278

Bug Description

标题: 子域名路由问题:访问不同子域名时返回错误页面

描述:
我在使用FRP进行内网穿透时遇到一个问题,当访问不同的子域名时,会返回错误的页面。当我访问一个子域名(例如 https://subdomain1.example.com:3443)时,页面显示正常。但随后访问另一个子域名(例如 https://subdomain2.example.com:3443)时,返回的却是第一个子域名的页面。这个问题在不同的设备和网络环境下都存在。关闭浏览器或使用无痕模式可以暂时解决问题,但在切换子域名后问题又会出现。

预期行为:
每个子域名应该显示其对应的页面,不应被其他子域名干扰。

实际行为:
访问一个子域名后,再访问另一个子域名会返回错误的页面。

附加信息:

  • 这个问题在不同的设备和网络环境下都存在。
  • 清除浏览器缓存和Cookie或使用无痕模式可以暂时解决问题。
  • FRP客户端和服务端日志中没有出现相关的错误信息或警告。

环境:

  • FRP版本: [0.58.1]
  • 操作系统: [客户端:ubuntu22.04],[服务端:尝试过ubuntu22.04和windows11均有此问题]
  • 浏览器: [edge,Firefox,safari]

frpc Version

0.58.1

frps Version

0.58.1

System Architecture

linux/amd64,windows/amd64

Configurations

客户端配置 (frpc.toml):

serverAddr = "xx.xx.xx.xx"
serverPort = 7000

[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = xxxx

[[proxies]]
name = "code"
type = "https"
subdomain = "code"

[proxies.plugin]
type = "https2http"
localAddr = "127.0.0.1:38089"
crtPath = "/etc/letsencrypt/live/example.com/example.com.crt"
keyPath = "/etc/letsencrypt/live/example.com/example.com.key"
hostHeaderRewrite = "code.example.com"
requestHeaders.set.x-from-where = "frp"

[[proxies]]
name = "portainer"
type = "https"
subdomain = "portainer"

[proxies.plugin]
type = "https2http"
localAddr = "127.0.0.1:9000"
crtPath = "/etc/letsencrypt/live/example.com/example.com.crt"
keyPath = "/etc/letsencrypt/live/example.com/example.com.key"
hostHeaderRewrite = "portainer.example.com"
requestHeaders.set.x-from-where = "frp"

[[proxies]]
name = "lobe"
type = "https"
subdomain = "lobechat"

[proxies.plugin]
type = "https2http"
localAddr = "127.0.0.1:3210"
crtPath = "/etc/letsencrypt/live/example.com/example.com.crt"
keyPath = "/etc/letsencrypt/live/example.com/example.com.key"
hostHeaderRewrite = "lobechat.example.com"
requestHeaders.set.x-from-where = "frp"

[[proxies]]
name = "newchat"
type = "https"
subdomain = "newchat"

[proxies.plugin]
type = "https2http"
localAddr = "127.0.0.1:6015"
crtPath = "/etc/letsencrypt/live/example.com/example.com.crt"
keyPath = "/etc/letsencrypt/live/example.com/example.com.key"
hostHeaderRewrite = "newchat.example.com"
requestHeaders.set.x-from-where = "frp"

服务端配置 (frps.toml):

bindPort = 7000
vhostHTTPPort = 8080
vhostHTTPSPort = 3443
subdomainHost = "example.com"

Logs

日志似乎没什么特殊的(使用gpt隐去了域名ip等):

2024-06-13 20:59:22.543 [I] [server/service.go:576] [7775bf3f146c1f82] client login info: ip [xx.xx.xx.xx:xxxxx] version [0.58.1] hostname [] os [linux] arch [amd64]
2024-06-13 20:59:22.571 [I] [proxy/https.go:79] [7775bf3f146c1f82] [lobe] https proxy listen for host [subdomain1.example.com]
2024-06-13 20:59:22.571 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [lobe] type [https] success
2024-06-13 20:59:22.571 [I] [proxy/https.go:79] [7775bf3f146c1f82] [newchat] https proxy listen for host [subdomain2.example.com]
2024-06-13 20:59:22.571 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [newchat] type [https] success
2024-06-13 20:59:22.571 [I] [proxy/https.go:79] [7775bf3f146c1f82] [code] https proxy listen for host [subdomain3.example.com]
2024-06-13 20:59:22.571 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [code] type [https] success
2024-06-13 20:59:22.571 [I] [proxy/http.go:144] [7775bf3f146c1f82] [ollama] http proxy listen for host [subdomain4.example.com] location [] group [], routeByHTTPUser []
2024-06-13 20:59:22.572 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [ollama] type [http] success
2024-06-13 20:59:22.572 [I] [proxy/https.go:79] [7775bf3f146c1f82] [portainer] https proxy listen for host [subdomain5.example.com]
2024-06-13 20:59:22.572 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [portainer] type [https] success
2024-06-13 20:59:22.573 [I] [proxy/tcp.go:82] [7775bf3f146c1f82] [ssh] tcp proxy listen port [xxxx]
2024-06-13 20:59:22.573 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [ssh] type [tcp] success

Steps to reproduce

  1. 在浏览器中访问 https://subdomain1.example.com:3443,页面显示正常。
  2. 不关闭浏览器,访问 https://subdomain2.example.com:3443,页面显示为 https://subdomain1.example.com:3443 的内容。
  3. 关闭浏览器或使用无痕模式。
  4. 再次访问 https://subdomain2.example.com:3443,页面显示正常。
  5. 现在访问 https://subdomain1.example.com:3443,页面显示为 https://subdomain2.example.com:3443 的内容。

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @zackeryyy00 on GitHub (Jun 13, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4278 ### Bug Description **标题**: 子域名路由问题:访问不同子域名时返回错误页面 **描述**: 我在使用FRP进行内网穿透时遇到一个问题,当访问不同的子域名时,会返回错误的页面。当我访问一个子域名(例如 `https://subdomain1.example.com:3443`)时,页面显示正常。但随后访问另一个子域名(例如 `https://subdomain2.example.com:3443`)时,返回的却是第一个子域名的页面。这个问题在不同的设备和网络环境下都存在。关闭浏览器或使用无痕模式可以暂时解决问题,但在切换子域名后问题又会出现。 **预期行为**: 每个子域名应该显示其对应的页面,不应被其他子域名干扰。 **实际行为**: 访问一个子域名后,再访问另一个子域名会返回错误的页面。 **附加信息**: - 这个问题在不同的设备和网络环境下都存在。 - 清除浏览器缓存和Cookie或使用无痕模式可以暂时解决问题。 - FRP客户端和服务端日志中没有出现相关的错误信息或警告。 **环境**: - FRP版本: [0.58.1] - 操作系统: [客户端:ubuntu22.04],[服务端:尝试过ubuntu22.04和windows11均有此问题] - 浏览器: [edge,Firefox,safari] ### frpc Version 0.58.1 ### frps Version 0.58.1 ### System Architecture linux/amd64,windows/amd64 ### Configurations **客户端配置 (`frpc.toml`)**: ```toml serverAddr = "xx.xx.xx.xx" serverPort = 7000 [[proxies]] name = "ssh" type = "tcp" localIP = "127.0.0.1" localPort = 22 remotePort = xxxx [[proxies]] name = "code" type = "https" subdomain = "code" [proxies.plugin] type = "https2http" localAddr = "127.0.0.1:38089" crtPath = "/etc/letsencrypt/live/example.com/example.com.crt" keyPath = "/etc/letsencrypt/live/example.com/example.com.key" hostHeaderRewrite = "code.example.com" requestHeaders.set.x-from-where = "frp" [[proxies]] name = "portainer" type = "https" subdomain = "portainer" [proxies.plugin] type = "https2http" localAddr = "127.0.0.1:9000" crtPath = "/etc/letsencrypt/live/example.com/example.com.crt" keyPath = "/etc/letsencrypt/live/example.com/example.com.key" hostHeaderRewrite = "portainer.example.com" requestHeaders.set.x-from-where = "frp" [[proxies]] name = "lobe" type = "https" subdomain = "lobechat" [proxies.plugin] type = "https2http" localAddr = "127.0.0.1:3210" crtPath = "/etc/letsencrypt/live/example.com/example.com.crt" keyPath = "/etc/letsencrypt/live/example.com/example.com.key" hostHeaderRewrite = "lobechat.example.com" requestHeaders.set.x-from-where = "frp" [[proxies]] name = "newchat" type = "https" subdomain = "newchat" [proxies.plugin] type = "https2http" localAddr = "127.0.0.1:6015" crtPath = "/etc/letsencrypt/live/example.com/example.com.crt" keyPath = "/etc/letsencrypt/live/example.com/example.com.key" hostHeaderRewrite = "newchat.example.com" requestHeaders.set.x-from-where = "frp" ``` **服务端配置 (`frps.toml`)**: ```toml bindPort = 7000 vhostHTTPPort = 8080 vhostHTTPSPort = 3443 subdomainHost = "example.com" ``` ### Logs 日志似乎没什么特殊的(使用gpt隐去了域名ip等): ``` 2024-06-13 20:59:22.543 [I] [server/service.go:576] [7775bf3f146c1f82] client login info: ip [xx.xx.xx.xx:xxxxx] version [0.58.1] hostname [] os [linux] arch [amd64] 2024-06-13 20:59:22.571 [I] [proxy/https.go:79] [7775bf3f146c1f82] [lobe] https proxy listen for host [subdomain1.example.com] 2024-06-13 20:59:22.571 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [lobe] type [https] success 2024-06-13 20:59:22.571 [I] [proxy/https.go:79] [7775bf3f146c1f82] [newchat] https proxy listen for host [subdomain2.example.com] 2024-06-13 20:59:22.571 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [newchat] type [https] success 2024-06-13 20:59:22.571 [I] [proxy/https.go:79] [7775bf3f146c1f82] [code] https proxy listen for host [subdomain3.example.com] 2024-06-13 20:59:22.571 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [code] type [https] success 2024-06-13 20:59:22.571 [I] [proxy/http.go:144] [7775bf3f146c1f82] [ollama] http proxy listen for host [subdomain4.example.com] location [] group [], routeByHTTPUser [] 2024-06-13 20:59:22.572 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [ollama] type [http] success 2024-06-13 20:59:22.572 [I] [proxy/https.go:79] [7775bf3f146c1f82] [portainer] https proxy listen for host [subdomain5.example.com] 2024-06-13 20:59:22.572 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [portainer] type [https] success 2024-06-13 20:59:22.573 [I] [proxy/tcp.go:82] [7775bf3f146c1f82] [ssh] tcp proxy listen port [xxxx] 2024-06-13 20:59:22.573 [I] [server/control.go:399] [7775bf3f146c1f82] new proxy [ssh] type [tcp] success ``` ### Steps to reproduce 1. 在浏览器中访问 `https://subdomain1.example.com:3443`,页面显示正常。 2. 不关闭浏览器,访问 `https://subdomain2.example.com:3443`,页面显示为 `https://subdomain1.example.com:3443` 的内容。 3. 关闭浏览器或使用无痕模式。 4. 再次访问 `https://subdomain2.example.com:3443`,页面显示正常。 5. 现在访问 `https://subdomain1.example.com:3443`,页面显示为 `https://subdomain2.example.com:3443` 的内容。 ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@xqzr commented on GitHub (Jun 13, 2024):

很早之前也遇到过,当时没有解决
应该是和 TLS Session Ticket 有关 https://cong5.net/post/nginx-ssl-session-tickets-error

<!-- gh-comment-id:2166020723 --> @xqzr commented on GitHub (Jun 13, 2024): **很早**之前也遇到过,当时没有解决 应该是和 TLS Session Ticket 有关 https://cong5.net/post/nginx-ssl-session-tickets-error
Author
Owner

@yuhuazhu commented on GitHub (Jun 27, 2024):

同样遇到了该问题,试着把TLS Session Ticket禁用了,还真可以了,真棒! @xqzr

<!-- gh-comment-id:2192887261 --> @yuhuazhu commented on GitHub (Jun 27, 2024): 同样遇到了该问题,试着把TLS Session Ticket禁用了,还真可以了,真棒! @xqzr
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#3375
No description provided.