[GH-ISSUE #2550] http 类型配置 locations 访问会404 #2028

Closed
opened 2026-05-05 13:18:38 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @toohandsome on GitHub (Aug 25, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2550

frpc 与 frps 均运行在本机
已配置 hosts 127.0.0.1 web.yourdomain.com
版本为 dev 分支最新代码
frpc 配置

[common]
server_addr = 127.0.0.1
server_port = 7001
admin_addr = 127.0.0.1
admin_port = 8080
admin_user = admin
admin_pwd = admin
token = 12345678
log_way = console

[web01]
type = http
local_port = 7500
custom_domains = web.yourdomain.com
locations = /about

[web02]
type = http
local_port = 8080
custom_domains = web.yourdomain.com
locations = /news

frps 配置

[common]
bind_port = 7001
log_way = console
token = 12345678
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin

vhost_http_port = 3367
vhost_https_port = 443

image

frpc 日志

2021/08/25 22:57:45 [I] [service.go:301] [246750f94038fcc7] login to server success, get run id [246750f94038fcc7], server udp port [0]
2021/08/25 22:57:45 [I] [proxy_manager.go:144] [246750f94038fcc7] proxy added: [web01 web02 innerAdmin]
2021/08/25 22:57:45 [I] [service.go:134] admin server listen on 127.0.0.1:8080
2021/08/25 22:57:45 [I] [control.go:180] [246750f94038fcc7] [web01] start proxy success
2021/08/25 22:57:45 [I] [control.go:180] [246750f94038fcc7] [web02] start proxy success
2021/08/25 22:57:45 [I] [control.go:180] [246750f94038fcc7] [innerAdmin] start proxy success

frps 日志

GOROOT=D:\Go #gosetup
GOPATH=D:\gopath #gosetup
D:\Go\bin\go.exe build -o C:\Users\Administrator\AppData\Local\Temp\GoLand\___frp_server.exe -gcflags "all=-N -l" github.com/fatedier/frp/cmd/frps #gosetup
"D:\GoLand 2021.2.1\plugins\go\lib\dlv\windows\dlv.exe" --listen=127.0.0.1:1110 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec C:\Users\Administrator\AppData\Local\Temp\GoLand\___frp_server.exe -- -c D:\gopath\src\frp\conf\frps.ini #gosetup
API server listening at: 127.0.0.1:1110
2021/08/25 22:57:44 [I] [root.go:200] frps uses config file: D:\gopath\src\frp\conf\frps.ini
2021/08/25 22:57:44 [I] [service.go:192] frps tcp listen on 0.0.0.0:7001
2021/08/25 22:57:44 [I] [service.go:235] http service listen on 0.0.0.0:3367
2021/08/25 22:57:44 [I] [service.go:250] https service listen on 0.0.0.0:443
2021/08/25 22:57:44 [I] [service.go:291] Dashboard listen on 0.0.0.0:7500
2021/08/25 22:57:44 [I] [root.go:209] frps started successfully
2021/08/25 22:57:45 [I] [service.go:447] [246750f94038fcc7] client login info: ip [127.0.0.1:1106] version [0.37.1] hostname [] os [windows] arch [amd64]
2021/08/25 22:57:45 [I] [http.go:92] [246750f94038fcc7] [web01] http proxy listen for host [web.yourdomain.com] location [/about] group []
2021/08/25 22:57:45 [I] [control.go:448] [246750f94038fcc7] new proxy [web01] success
2021/08/25 22:57:45 [I] [http.go:92] [246750f94038fcc7] [web02] http proxy listen for host [web.yourdomain.com] location [/news] group []
2021/08/25 22:57:45 [I] [control.go:448] [246750f94038fcc7] new proxy [web02] success
2021/08/25 22:57:45 [I] [tcp.go:63] [246750f94038fcc7] [innerAdmin] tcp proxy listen port [777]
2021/08/25 22:57:45 [I] [control.go:448] [246750f94038fcc7] new proxy [innerAdmin] success
2021/08/25 22:58:35 [W] [http.go:92] do http proxy request error: no such domain: web.yourdomain.com /favicon.ico

多个版本均存在此问题
image

Originally created by @toohandsome on GitHub (Aug 25, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2550 frpc 与 frps 均运行在本机 已配置 hosts 127.0.0.1 web.yourdomain.com 版本为 dev 分支最新代码 frpc 配置 ``` [common] server_addr = 127.0.0.1 server_port = 7001 admin_addr = 127.0.0.1 admin_port = 8080 admin_user = admin admin_pwd = admin token = 12345678 log_way = console [web01] type = http local_port = 7500 custom_domains = web.yourdomain.com locations = /about [web02] type = http local_port = 8080 custom_domains = web.yourdomain.com locations = /news ``` frps 配置 ``` [common] bind_port = 7001 log_way = console token = 12345678 dashboard_addr = 0.0.0.0 dashboard_port = 7500 dashboard_user = admin dashboard_pwd = admin vhost_http_port = 3367 vhost_https_port = 443 ``` ![image](https://user-images.githubusercontent.com/46422252/130815116-8cf186ef-3ea8-4522-92f5-8d97cdec9e3b.png) frpc 日志 ``` 2021/08/25 22:57:45 [I] [service.go:301] [246750f94038fcc7] login to server success, get run id [246750f94038fcc7], server udp port [0] 2021/08/25 22:57:45 [I] [proxy_manager.go:144] [246750f94038fcc7] proxy added: [web01 web02 innerAdmin] 2021/08/25 22:57:45 [I] [service.go:134] admin server listen on 127.0.0.1:8080 2021/08/25 22:57:45 [I] [control.go:180] [246750f94038fcc7] [web01] start proxy success 2021/08/25 22:57:45 [I] [control.go:180] [246750f94038fcc7] [web02] start proxy success 2021/08/25 22:57:45 [I] [control.go:180] [246750f94038fcc7] [innerAdmin] start proxy success ``` frps 日志 ``` GOROOT=D:\Go #gosetup GOPATH=D:\gopath #gosetup D:\Go\bin\go.exe build -o C:\Users\Administrator\AppData\Local\Temp\GoLand\___frp_server.exe -gcflags "all=-N -l" github.com/fatedier/frp/cmd/frps #gosetup "D:\GoLand 2021.2.1\plugins\go\lib\dlv\windows\dlv.exe" --listen=127.0.0.1:1110 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec C:\Users\Administrator\AppData\Local\Temp\GoLand\___frp_server.exe -- -c D:\gopath\src\frp\conf\frps.ini #gosetup API server listening at: 127.0.0.1:1110 2021/08/25 22:57:44 [I] [root.go:200] frps uses config file: D:\gopath\src\frp\conf\frps.ini 2021/08/25 22:57:44 [I] [service.go:192] frps tcp listen on 0.0.0.0:7001 2021/08/25 22:57:44 [I] [service.go:235] http service listen on 0.0.0.0:3367 2021/08/25 22:57:44 [I] [service.go:250] https service listen on 0.0.0.0:443 2021/08/25 22:57:44 [I] [service.go:291] Dashboard listen on 0.0.0.0:7500 2021/08/25 22:57:44 [I] [root.go:209] frps started successfully 2021/08/25 22:57:45 [I] [service.go:447] [246750f94038fcc7] client login info: ip [127.0.0.1:1106] version [0.37.1] hostname [] os [windows] arch [amd64] 2021/08/25 22:57:45 [I] [http.go:92] [246750f94038fcc7] [web01] http proxy listen for host [web.yourdomain.com] location [/about] group [] 2021/08/25 22:57:45 [I] [control.go:448] [246750f94038fcc7] new proxy [web01] success 2021/08/25 22:57:45 [I] [http.go:92] [246750f94038fcc7] [web02] http proxy listen for host [web.yourdomain.com] location [/news] group [] 2021/08/25 22:57:45 [I] [control.go:448] [246750f94038fcc7] new proxy [web02] success 2021/08/25 22:57:45 [I] [tcp.go:63] [246750f94038fcc7] [innerAdmin] tcp proxy listen port [777] 2021/08/25 22:57:45 [I] [control.go:448] [246750f94038fcc7] new proxy [innerAdmin] success 2021/08/25 22:58:35 [W] [http.go:92] do http proxy request error: no such domain: web.yourdomain.com /favicon.ico ``` 多个版本均存在此问题 ![image](https://user-images.githubusercontent.com/46422252/130821345-d3a62a6c-e121-43b5-95cd-05cdbf1754e8.png)
gitea-mirror 2026-05-05 13:18:39 -06:00
Author
Owner

@fatedier commented on GitHub (Aug 26, 2021):

404 可能是你自己的 HTTP 服务返回的,你确认你自己的服务有 /about , /news 这些路径吗?

<!-- gh-comment-id:906050367 --> @fatedier commented on GitHub (Aug 26, 2021): 404 可能是你自己的 HTTP 服务返回的,你确认你自己的服务有 /about , /news 这些路径吗?
Author
Owner

@toohandsome commented on GitHub (Aug 26, 2021):

404 可能是你自己的 HTTP 服务返回的,你确认你自己的服务有 /about , /news 这些路径吗?

frpc 中配置的 locations = /news ,这个意思不是 我访问 web.yourdomain.com/news 会帮我转发到 127.0.0.1:8080 吗

<!-- gh-comment-id:906071451 --> @toohandsome commented on GitHub (Aug 26, 2021): > 404 可能是你自己的 HTTP 服务返回的,你确认你自己的服务有 /about , /news 这些路径吗? frpc 中配置的 locations = /news ,这个意思不是 我访问 web.yourdomain.com/news 会帮我转发到 127.0.0.1:8080 吗
Author
Owner

@github-actions[bot] commented on GitHub (Sep 26, 2021):

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

<!-- gh-comment-id:927203915 --> @github-actions[bot] commented on GitHub (Sep 26, 2021): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@AlessandroChecco commented on GitHub (Jan 26, 2022):

404 may be returned by your own HTTP service. Have you confirmed that your own service has these paths /about , /news?

The locations configured in frpc = /news, does this mean that when I visit web.yourdomain.com/news, it will be forwarded to 127.0.0.1:8080 for me?

I interpreted it in the same way, but apparently not. I am wondering if there is another way to achieve this functionality

<!-- gh-comment-id:1022466035 --> @AlessandroChecco commented on GitHub (Jan 26, 2022): > > 404 may be returned by your own HTTP service. Have you confirmed that your own service has these paths /about , /news? > > The locations configured in frpc = /news, does this mean that when I visit web.yourdomain.com/news, it will be forwarded to 127.0.0.1:8080 for me? I interpreted it in the same way, but apparently not. I am wondering if there is another way to achieve this functionality
Author
Owner

@touchmii commented on GitHub (Sep 1, 2022):

404 可能是你自己的 HTTP 服务返回的,你确认你自己的服务有 /about , /news 这些路径吗?

frpc 中配置的 locations = /news ,这个意思不是 我访问 web.yourdomain.com/news 会帮我转发到 127.0.0.1:8080 吗

看来不是你想的那个作用,还是通过nginx反向代理来实现吧,要是frp直接直接就好了,方便走cdn。

<!-- gh-comment-id:1234797946 --> @touchmii commented on GitHub (Sep 1, 2022): > > 404 可能是你自己的 HTTP 服务返回的,你确认你自己的服务有 /about , /news 这些路径吗? > > frpc 中配置的 locations = /news ,这个意思不是 我访问 web.yourdomain.com/news 会帮我转发到 127.0.0.1:8080 吗 看来不是你想的那个作用,还是通过nginx反向代理来实现吧,要是frp直接直接就好了,方便走cdn。
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#2028
No description provided.