[GH-ISSUE #4871] frp HTTP代理使用IP地址作为customDomains时返回404,TCP代理出现unexpected end of stream错误 #3843

Closed
opened 2026-05-05 14:27:26 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @dream-one on GitHub (Jul 7, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4871

Bug Description

环境描述

  • frp版本:v0.63.0
  • 操作系统: frps:contos,frpc:ubuntu 22.04
  • 网络环境: Python服务部署在内网,通过frp进行内网穿透

frpc Version

v0.63.0

frps Version

v0.63.0

System Architecture

frps:contos,frpc:ubuntu 22.04

Configurations

配置文件

frps.toml (服务端):

bindPort = 7000
vhostHTTPPort = 8013

frpc.toml (客户端):

serverAddr = "43.143.124.141"
serverPort = 7000

[transport]
dialServerKeepAlive = 30

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

[[proxies]]
name = "python-diagnosis"
type = "http"
localIP = "127.0.0.1"
localPort = 5000
customDomains = ["43.143.124.141"]

内网服务

  • Python Flask服务: 运行在 127.0.0.1:5000
  • 端点: /diagnose (POST请求)
  • 本地测试: curl -X POST http://127.0.0.1:5000/diagnose 正常工作

问题现象

1. HTTP代理配置 - 返回404错误

通过frp访问 http://43.143.124.141:8013/diagnose 时返回404错误:

<!DOCTYPE html>
<html>
<head>
<title>Not Found</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>The page you requested was not found.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p>
<p><em>Faithfully yours, frp.</em></p>
</body>
</html>

2. TCP代理配置 - 连接异常

当改为TCP代理配置时:

[[proxies]]
name = "python-diagnosis"
type = "tcp"
localIP = "127.0.0.1"
localPort = 5000
remotePort = 8013

出现新错误:

java.io.IOException: unexpected end of stream on http://43.143.124.141:8013/...

请求详情

  • 客户端: Java应用使用OkHttp
  • 请求URL: http://43.143.124.141:8013/diagnose
  • 请求头:
    • Host: 43.143.124.141
    • Content-Type: application/json
    • Connection: close
  • 请求方法: POST
  • 请求体: JSON格式的数据

已尝试的解决方案

  1. 不同的customDomains设置: 尝试了IP地址和域名
  2. 不同的Host头设置: 确保与customDomains匹配
  3. TCP代理: 改为TCP代理后出现连接异常
  4. 重启frp服务: 多次重启客户端和服务端

疑问

  1. HTTP代理中使用IP地址作为customDomains是否支持?
  2. 为什么TCP代理会出现"unexpected end of stream"错误?
  3. 是否有推荐的配置方式来代理内网HTTP服务?

期望结果

希望能够通过frp正常访问内网的Python Flask服务,无论是使用HTTP代理还是TCP代理。

Logs

No response

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @dream-one on GitHub (Jul 7, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4871 ### Bug Description ### 环境描述 - **frp版本**:v0.63.0 - **操作系统**: frps:contos,frpc:ubuntu 22.04 - **网络环境**: Python服务部署在内网,通过frp进行内网穿透 ### frpc Version v0.63.0 ### frps Version v0.63.0 ### System Architecture frps:contos,frpc:ubuntu 22.04 ### Configurations ### 配置文件 **frps.toml (服务端):** ```toml bindPort = 7000 vhostHTTPPort = 8013 ``` **frpc.toml (客户端):** ```toml serverAddr = "43.143.124.141" serverPort = 7000 [transport] dialServerKeepAlive = 30 [[proxies]] name = "ssh" type = "tcp" localIP = "127.0.0.1" localPort = 22 remotePort = 6000 [[proxies]] name = "python-diagnosis" type = "http" localIP = "127.0.0.1" localPort = 5000 customDomains = ["43.143.124.141"] ``` ### 内网服务 - **Python Flask服务**: 运行在 `127.0.0.1:5000` - **端点**: `/diagnose` (POST请求) - **本地测试**: `curl -X POST http://127.0.0.1:5000/diagnose` 正常工作 ### 问题现象 #### 1. HTTP代理配置 - 返回404错误 通过frp访问 `http://43.143.124.141:8013/diagnose` 时返回404错误: ```html <!DOCTYPE html> <html> <head> <title>Not Found</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>The page you requested was not found.</h1> <p>Sorry, the page you are looking for is currently unavailable.<br/> Please try again later.</p> <p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p> <p><em>Faithfully yours, frp.</em></p> </body> </html> ``` #### 2. TCP代理配置 - 连接异常 当改为TCP代理配置时: ```toml [[proxies]] name = "python-diagnosis" type = "tcp" localIP = "127.0.0.1" localPort = 5000 remotePort = 8013 ``` 出现新错误: ``` java.io.IOException: unexpected end of stream on http://43.143.124.141:8013/... ``` ### 请求详情 - **客户端**: Java应用使用OkHttp - **请求URL**: `http://43.143.124.141:8013/diagnose` - **请求头**: - `Host: 43.143.124.141` - `Content-Type: application/json` - `Connection: close` - **请求方法**: POST - **请求体**: JSON格式的数据 ### 已尝试的解决方案 1. **不同的customDomains设置**: 尝试了IP地址和域名 2. **不同的Host头设置**: 确保与customDomains匹配 3. **TCP代理**: 改为TCP代理后出现连接异常 4. **重启frp服务**: 多次重启客户端和服务端 ### 疑问 1. HTTP代理中使用IP地址作为`customDomains`是否支持? 2. 为什么TCP代理会出现"unexpected end of stream"错误? 3. 是否有推荐的配置方式来代理内网HTTP服务? ### 期望结果 希望能够通过frp正常访问内网的Python Flask服务,无论是使用HTTP代理还是TCP代理。 ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:27:26 -06:00
Author
Owner

@github-actions[bot] commented on GitHub (Jul 22, 2025):

Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.

<!-- gh-comment-id:3100155298 --> @github-actions[bot] commented on GitHub (Jul 22, 2025): Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
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#3843
No description provided.