[GH-ISSUE #676] 同一个HTTP请求,内网服务正常返回结果,通过FRP穿透访问后报404错误 #531

Closed
opened 2026-05-05 12:20:47 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @yqhwd on GitHub (Mar 26, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/676

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)?
0.16.1

What operating system and processor architecture are you using (go env)?
服务器端:windows server 2012/CentOS7
客户端:windows server 2012/CentOS7

Configures you used:

frps.ini

[common]
bind_port = 7000
vhost_http_port = 7080
vhost_https_port = 443

dashboard 用户名密码,默认都为 admin

dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = XXXXXXX

log_file = /frp/log/frps.log
log_level = trace
log_max_days = 60

privilege_token = XXXXXX

max_pool_count = 100
authentication_timeout = 0

frpc.ini

[common]
server_addr = XXX.XXX.XXX.XXX
server_port = 7000

log_file = /frp/log/frpc.log
log_level = trace
log_max_days = 60

privilege_token = kysoftadmin123

pool_count = 30

#通过 ssh 访问公司内网机器
[ssh4]
type = tcp
local_ip = 192.168.5.201
local_port = 22
remote_port = 6000
use_encryption = true
use_compression = true

#通过 ssh 访问公司内网机器 gitlab
[ssh1]
type = tcp
local_ip = 192.168.5.201
local_port = 8000
remote_port = 8000
use_encryption = true
use_compression = true

#远程桌面
[ssh2]
type = tcp
local_ip = 192.168.5.186
local_port = 3389
remote_port = 3389
use_encryption = true
use_compression = true

#本地数据库
[ssh3]
type = tcp
local_ip = 192.168.5.186
local_port = 1521
remote_port = 1521
use_encryption = true
use_compression = true

#通过自定义域名访问部署于内网的 web 服务
[web1]
type = http
local_ip = 192.168.5.201
local_port = 7080
#custom_domains 不能重复
custom_domains = 47.92.99.48
use_encryption = true
use_compression = true

#转发 DNS 查询请求
[dns]
type = udp
local_ip = 8.8.8.8
local_port = 53
remote_port = 6001
use_encryption = true
use_compression = true
[root@oracledb frp]#
[root@oracledb frp]#
[root@oracledb frp]#
[root@oracledb frp]# cat frpc.ini

frpc.ini

[common]
server_addr = 47.92.99.48
server_port = 7000

log_file = /frp/log/frpc.log
log_level = trace
log_max_days = 60

privilege_token = kysoftadmin123

pool_count = 30

#通过 ssh 访问公司内网机器
[ssh4]
type = tcp
local_ip = 192.168.5.201
local_port = 22
remote_port = 6000
use_encryption = true
use_compression = true

#通过 ssh 访问公司内网机器 gitlab
[ssh1]
type = tcp
local_ip = 192.168.5.201
local_port = 8000
remote_port = 8000
use_encryption = true
use_compression = true

#远程桌面
[ssh2]
type = tcp
local_ip = 192.168.5.186
local_port = 3389
remote_port = 3389
use_encryption = true
use_compression = true

#本地数据库
[ssh3]
type = tcp
local_ip = 192.168.5.186
local_port = 1521
remote_port = 1521
use_encryption = true
use_compression = true

#通过自定义域名访问部署于内网的 web 服务
[web1]
type = http
local_ip = 192.168.5.201
local_port = 7080
#custom_domains 不能重复
custom_domains = 47.92.99.48
use_encryption = true
use_compression = true

#转发 DNS 查询请求
[dns]
type = udp
local_ip = 8.8.8.8
local_port = 53
remote_port = 6001
use_encryption = true
use_compression = true

Steps to reproduce the issue:
1.http://XXX.XXX.XXX.XXX:7080/248/cpkpk_st_bjm/get_data.jsp?dw_id=1000&db_xm=cpkpk_jz&sql_str=select zsdwbm,pjid,kpr,count(distinct bh_from),sum(jxje) from pjlyjx where zth=1 and synd=2018 and (ym<=3 or jx_yy<2018) and bh_from is not null and isnull(zfbz,'0')='0' and exists ( select b.sfr from pjlyjx b where pjlyjx.dw_id=b.dw_id and pjlyjx.zth=b.zth and pjlyjx.synd=b.synd and pjlyjx.hjsxh=b.jbdbh and b.sfr is not null) and (isnull(yhdjbz,0)=0) and exists ( select pjdwxx.dwbm from qx_zsdw,pjdwxx where qx_zsdw.user_id='zzm' and pjdwxx.dw_id='1000' and pjdwxx.zth=1 and qx_zsdw.dw_id=pjdwxx.dw_id and qx_zsdw.zth=pjdwxx.zth and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm) group by zsdwbm,pjid,kpr#end#
2.页面404错误
The page you visit not found.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

The server is powered by frp.

Faithfully yours, frp.
3.http://XXX.XXX.XXX.XXX:7080/248/cpkpk_st_bjm/get_data.jsp?dw_id=1000&db_xm=cpkpk_jz&sql_str=select zsdwbm,pjid,kpr,count(distinct bh_from),sum(jxje) from pjlyjx where zth=1 and synd=2018 and (ym<=3 or jx_yy<2018) and bh_from is not null and isnull(zfbz,'0')='0' and exists ( select b.sfr from pjlyjx b where pjlyjx.dw_id=b.dw_id and pjlyjx.zth=b.zth and pjlyjx.synd=b.synd and pjlyjx.hjsxh=b.jbdbh and b.sfr is not null) and (isnull(yhdjbz,0)=0) and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm) group by zsdwbm,pjid,kpr#end#
正常返回结果

Describe the results you received:
The page you visit not found.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

The server is powered by frp.

Faithfully yours, frp.

Describe the results you expected:
正常返回数据库查询结果

Additional information you deem important (e.g. issue happens only occasionally):

and exists ( select pjdwxx.dwbm from qx_zsdw,pjdwxx where qx_zsdw.user_id='zzm' and pjdwxx.dw_id='1000' and pjdwxx.zth=1 and qx_zsdw.dw_id=pjdwxx.dw_id and qx_zsdw.zth=pjdwxx.zth and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm)
将HTTP参数中的这段去掉就正常
HTTP参数全部加上后,直接访问内网HTTP服务,能正常返回结果

Can you point out what caused this issue (optional)
and exists ( select pjdwxx.dwbm from qx_zsdw,pjdwxx where qx_zsdw.user_id='zzm' and pjdwxx.dw_id='1000' and pjdwxx.zth=1 and qx_zsdw.dw_id=pjdwxx.dw_id and qx_zsdw.zth=pjdwxx.zth and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm)
将HTTP参数中的这段去掉就正常
HTTP参数全部加上后,直接访问内网HTTP服务,能正常返回结果

Originally created by @yqhwd on GitHub (Mar 26, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/676 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)?** 0.16.1 **What operating system and processor architecture are you using (`go env`)?** 服务器端:windows server 2012/CentOS7 客户端:windows server 2012/CentOS7 **Configures you used:** # frps.ini [common] bind_port = 7000 vhost_http_port = 7080 vhost_https_port = 443 # dashboard 用户名密码,默认都为 admin dashboard_port = 7500 dashboard_user = admin dashboard_pwd = XXXXXXX log_file = /frp/log/frps.log log_level = trace log_max_days = 60 privilege_token = XXXXXX max_pool_count = 100 authentication_timeout = 0 # frpc.ini [common] server_addr = XXX.XXX.XXX.XXX server_port = 7000 log_file = /frp/log/frpc.log log_level = trace log_max_days = 60 privilege_token = kysoftadmin123 pool_count = 30 #通过 ssh 访问公司内网机器 [ssh4] type = tcp local_ip = 192.168.5.201 local_port = 22 remote_port = 6000 use_encryption = true use_compression = true #通过 ssh 访问公司内网机器 gitlab [ssh1] type = tcp local_ip = 192.168.5.201 local_port = 8000 remote_port = 8000 use_encryption = true use_compression = true #远程桌面 [ssh2] type = tcp local_ip = 192.168.5.186 local_port = 3389 remote_port = 3389 use_encryption = true use_compression = true #本地数据库 [ssh3] type = tcp local_ip = 192.168.5.186 local_port = 1521 remote_port = 1521 use_encryption = true use_compression = true #通过自定义域名访问部署于内网的 web 服务 [web1] type = http local_ip = 192.168.5.201 local_port = 7080 #custom_domains 不能重复 custom_domains = 47.92.99.48 use_encryption = true use_compression = true #转发 DNS 查询请求 [dns] type = udp local_ip = 8.8.8.8 local_port = 53 remote_port = 6001 use_encryption = true use_compression = true [root@oracledb frp]# [root@oracledb frp]# [root@oracledb frp]# [root@oracledb frp]# cat frpc.ini # frpc.ini [common] server_addr = 47.92.99.48 server_port = 7000 log_file = /frp/log/frpc.log log_level = trace log_max_days = 60 privilege_token = kysoftadmin123 pool_count = 30 #通过 ssh 访问公司内网机器 [ssh4] type = tcp local_ip = 192.168.5.201 local_port = 22 remote_port = 6000 use_encryption = true use_compression = true #通过 ssh 访问公司内网机器 gitlab [ssh1] type = tcp local_ip = 192.168.5.201 local_port = 8000 remote_port = 8000 use_encryption = true use_compression = true #远程桌面 [ssh2] type = tcp local_ip = 192.168.5.186 local_port = 3389 remote_port = 3389 use_encryption = true use_compression = true #本地数据库 [ssh3] type = tcp local_ip = 192.168.5.186 local_port = 1521 remote_port = 1521 use_encryption = true use_compression = true #通过自定义域名访问部署于内网的 web 服务 [web1] type = http local_ip = 192.168.5.201 local_port = 7080 #custom_domains 不能重复 custom_domains = 47.92.99.48 use_encryption = true use_compression = true #转发 DNS 查询请求 [dns] type = udp local_ip = 8.8.8.8 local_port = 53 remote_port = 6001 use_encryption = true use_compression = true **Steps to reproduce the issue:** 1.http://XXX.XXX.XXX.XXX:7080/248/cpkpk_st_bjm/get_data.jsp?dw_id=1000&db_xm=cpkpk_jz&sql_str=select zsdwbm,pjid,kpr,count(distinct bh_from),sum(jxje) from pjlyjx where zth=1 and synd=2018 and (ym<=3 or jx_yy<2018) and bh_from is not null and isnull(zfbz,'0')='0' and exists ( select b.sfr from pjlyjx b where pjlyjx.dw_id=b.dw_id and pjlyjx.zth=b.zth and pjlyjx.synd=b.synd and pjlyjx.hjsxh=b.jbdbh and b.sfr is not null) and (isnull(yhdjbz,0)=0) and exists ( select pjdwxx.dwbm from qx_zsdw,pjdwxx where qx_zsdw.user_id='zzm' and pjdwxx.dw_id='1000' and pjdwxx.zth=1 and qx_zsdw.dw_id=pjdwxx.dw_id and qx_zsdw.zth=pjdwxx.zth and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm) group by zsdwbm,pjid,kpr#end# 2.页面404错误 The page you visit not found. Sorry, the page you are looking for is currently unavailable. Please try again later. The server is powered by frp. Faithfully yours, frp. 3.http://XXX.XXX.XXX.XXX:7080/248/cpkpk_st_bjm/get_data.jsp?dw_id=1000&db_xm=cpkpk_jz&sql_str=select zsdwbm,pjid,kpr,count(distinct bh_from),sum(jxje) from pjlyjx where zth=1 and synd=2018 and (ym<=3 or jx_yy<2018) and bh_from is not null and isnull(zfbz,'0')='0' and exists ( select b.sfr from pjlyjx b where pjlyjx.dw_id=b.dw_id and pjlyjx.zth=b.zth and pjlyjx.synd=b.synd and pjlyjx.hjsxh=b.jbdbh and b.sfr is not null) and (isnull(yhdjbz,0)=0) and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm) group by zsdwbm,pjid,kpr#end# 正常返回结果 **Describe the results you received:** The page you visit not found. Sorry, the page you are looking for is currently unavailable. Please try again later. The server is powered by frp. Faithfully yours, frp. **Describe the results you expected:** 正常返回数据库查询结果 **Additional information you deem important (e.g. issue happens only occasionally):** and exists ( select pjdwxx.dwbm from qx_zsdw,pjdwxx where qx_zsdw.user_id='zzm' and pjdwxx.dw_id='1000' and pjdwxx.zth=1 and qx_zsdw.dw_id=pjdwxx.dw_id and qx_zsdw.zth=pjdwxx.zth and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm) 将HTTP参数中的这段去掉就正常 HTTP参数全部加上后,直接访问内网HTTP服务,能正常返回结果 **Can you point out what caused this issue (optional)** and exists ( select pjdwxx.dwbm from qx_zsdw,pjdwxx where qx_zsdw.user_id='zzm' and pjdwxx.dw_id='1000' and pjdwxx.zth=1 and qx_zsdw.dw_id=pjdwxx.dw_id and qx_zsdw.zth=pjdwxx.zth and substring(pjdwxx.dwbm,1,datalength(rtrim(qx_zsdw.dwbm)))=qx_zsdw.dwbm and pjlyjx.zsdwbm=pjdwxx.dwbm) 将HTTP参数中的这段去掉就正常 HTTP参数全部加上后,直接访问内网HTTP服务,能正常返回结果
Author
Owner

@fatedier commented on GitHub (Mar 28, 2018):

可能是 url 长度过长,不是很确定,建议将参数放在 http request body 中传递试试有没有问题?

<!-- gh-comment-id:376934504 --> @fatedier commented on GitHub (Mar 28, 2018): 可能是 url 长度过长,不是很确定,建议将参数放在 http request body 中传递试试有没有问题?
Author
Owner

@yqhwd commented on GitHub (Mar 29, 2018):

@fatedier 应该不是URL过长的原因,我试过采用另外一种写法,长度超过了有问题的那段参数,能正确返回结果。

<!-- gh-comment-id:377087352 --> @yqhwd commented on GitHub (Mar 29, 2018): @fatedier 应该不是URL过长的原因,我试过采用另外一种写法,长度超过了有问题的那段参数,能正确返回结果。
Author
Owner

@yqhwd commented on GitHub (Mar 29, 2018):

@fatedier 另外说明一下,我的WEB服务器是RESIN,出错的时候观察RESIN日志,其实请求是能转发到RESIN的,但是不知道为什么RESIN处理完后页面就报404错误了

<!-- gh-comment-id:377088363 --> @yqhwd commented on GitHub (Mar 29, 2018): @fatedier 另外说明一下,我的WEB服务器是RESIN,出错的时候观察RESIN日志,其实请求是能转发到RESIN的,但是不知道为什么RESIN处理完后页面就报404错误了
Author
Owner

@fatedier commented on GitHub (Mar 29, 2018):

对你的 web 服务端口抓包,对比下直接发送和通过 frp 转发时,请求和响应结果有什么差异。

<!-- gh-comment-id:377098865 --> @fatedier commented on GitHub (Mar 29, 2018): 对你的 web 服务端口抓包,对比下直接发送和通过 frp 转发时,请求和响应结果有什么差异。
Author
Owner

@yqhwd commented on GitHub (Mar 29, 2018):

@fatedier 很奇怪,今天莫名其妙的好了

<!-- gh-comment-id:377137023 --> @yqhwd commented on GitHub (Mar 29, 2018): @fatedier 很奇怪,今天莫名其妙的好了
Author
Owner

@fatedier commented on GitHub (Mar 29, 2018):

这个 issue 先 close 了,后面如果出现了类似的问题,建议先抓包和排查下网络问题,看看是否中间增加或删除了什么数据。

<!-- gh-comment-id:377212022 --> @fatedier commented on GitHub (Mar 29, 2018): 这个 issue 先 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#531
No description provided.