[GH-ISSUE #791] HTTP转发中需要解决的问题 #617

Closed
opened 2026-05-05 12:24:05 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @opensesamedoors on GitHub (May 23, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/791

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.19

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

Configures you used:
frpc
[common]
server_addr = 45.76.151.106
server_port = 7000
token = frp12345678
log_file = ./frpc.log

debug, info, warn, error

log_level = debug

[web]
type = http
local_ip = 192.168.1.1
local_port = 80
remote_port = 80
custom_domains = ttteeesssttt.com
host_header_rewrite = 192.168.1.1

frps
[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 80
log_file = ./frps.log
log_level = debug
token = frp12345678

Steps to reproduce the issue:
1.192.168.1.1为本地路由器,TP LINK 80端口为管理端口,目的是模拟远程管理本地只能内网管理的modem。
2.两台虚拟机,本地网关都为192.168.1.1。虚拟机A运行frpc,配置如上。虚拟机B上通过更改C:\windows\system32\drivers\etc\host文件域名劫持ttteeesssttt.com 到 45.76.151.106
3.VPS 45.76.151.106运行frps,配置如上。
4、在虚拟机B上访问HTTP://ttteeesssttt.com,可以出现登录界面,可以输入用户名口令,两台虚拟机都装wireshark,A虚拟机上发现HOST头部被更改为192.168.1.1,但后续的头部referer字段中仍是ttteeesssttt.com,导致tplink返回给A虚拟机(负责转发)的返回值为403,禁止访问。对比直接访问成功数据,应该是要将所有HTTP协议中涉及到地址的地方都进行修改
5、最后建议HTTP协议头部应该允许字符串直接替换,这样实现起来比较方便,可以将HOST REFERER等HTTP协议中涉及到地址的统一替换,完成HTTP协议的正常通信。

Describe the results you received:
403 FORBIDDEN

Describe the results you expected:
200 OK

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

Can you point out what caused this issue (optional)

Originally created by @opensesamedoors on GitHub (May 23, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/791 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.19 **What operating system and processor architecture are you using (`go env`)?** Windows X64 **Configures you used:** frpc [common] server_addr = 45.76.151.106 server_port = 7000 token = frp12345678 log_file = ./frpc.log # debug, info, warn, error log_level = debug [web] type = http local_ip = 192.168.1.1 local_port = 80 remote_port = 80 custom_domains = ttteeesssttt.com host_header_rewrite = 192.168.1.1 frps [common] bind_addr = 0.0.0.0 bind_port = 7000 vhost_http_port = 80 log_file = ./frps.log log_level = debug token = frp12345678 **Steps to reproduce the issue:** 1.192.168.1.1为本地路由器,TP LINK 80端口为管理端口,目的是模拟远程管理本地只能内网管理的modem。 2.两台虚拟机,本地网关都为192.168.1.1。虚拟机A运行frpc,配置如上。虚拟机B上通过更改C:\windows\system32\drivers\etc\host文件域名劫持ttteeesssttt.com 到 45.76.151.106 3.VPS 45.76.151.106运行frps,配置如上。 4、在虚拟机B上访问HTTP://ttteeesssttt.com,可以出现登录界面,可以输入用户名口令,两台虚拟机都装wireshark,A虚拟机上发现HOST头部被更改为192.168.1.1,但后续的头部referer字段中仍是ttteeesssttt.com,导致tplink返回给A虚拟机(负责转发)的返回值为403,禁止访问。对比直接访问成功数据,应该是要将所有HTTP协议中涉及到地址的地方都进行修改。 5、最后建议HTTP协议头部应该允许字符串直接替换,这样实现起来比较方便,可以将HOST REFERER等HTTP协议中涉及到地址的统一替换,完成HTTP协议的正常通信。 **Describe the results you received:** 403 FORBIDDEN **Describe the results you expected:** 200 OK **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
Author
Owner

@fatedier commented on GitHub (May 23, 2018):

Duplicate of #769

<!-- gh-comment-id:391300468 --> @fatedier commented on GitHub (May 23, 2018): Duplicate of #769
Author
Owner

@nanshaobit commented on GitHub (May 8, 2022):

已经解决了嘛?
Host 修改后,
Origin、Referer依旧是修改前的域名,确实会导致验证Referer的程序拒绝提供服务,请问有解决方案可以整体替换吗?

<!-- gh-comment-id:1120391678 --> @nanshaobit commented on GitHub (May 8, 2022): 已经解决了嘛? Host 修改后, Origin、Referer依旧是修改前的域名,确实会导致验证Referer的程序拒绝提供服务,请问有解决方案可以整体替换吗?
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#617
No description provided.