[GH-ISSUE #591] dashboard运行在web反向代理后面出现重定向错误 #460

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

Originally created by @jimstar06 on GitHub (Jan 7, 2018).
Original GitHub issue: https://github.com/fatedier/frp/issues/591

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

What operating system and processor architecture are you using (go env)?
all platform

Configures you used:
出于安全考虑我想让dashboard运行在caddy服务器后面,使用https反向代理
frps.ini(partial)

[common]
bind_port = 40000
kcp_bind_port = 40000
privilege_allow_ports = 40004-49999
privilege_token = XXXX
dashboard_port = 40001
dashboard_user = admin
dashboard_pwd = XXXX

Caddyfile

example.com {
    proxy /frp/ localhost:40001 {
        without /frp
    }
}

Steps to reproduce the issue:

  1. 访问https://example.com/frp/
  2. 输入用户名和密码

Describe the results you received:
页面被重定向至https://example.com/static/

Describe the results you expected:
页面被重定向至https://example.com/frp/static/

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

Can you point out what caused this issue (optional)
dashboard使用<a href="/static/">Moved Permanently</a>.重定向,应该使用相对路径static/,后续资源应该使用相对路径访问(static,api等)。
如果使用单一域名反向代理dashboard,问题不会出现。
关于反向代理的使用方法参考 netdata wiki的run netdata in a subfolder。
caddy反向代理参考文档
该问题应该影响所有web服务器。

Originally created by @jimstar06 on GitHub (Jan 7, 2018). Original GitHub issue: https://github.com/fatedier/frp/issues/591 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.14.1 **What operating system and processor architecture are you using (`go env`)?** all platform **Configures you used:** 出于安全考虑我想让dashboard运行在caddy服务器后面,使用https反向代理 frps.ini(partial) ``` [common] bind_port = 40000 kcp_bind_port = 40000 privilege_allow_ports = 40004-49999 privilege_token = XXXX dashboard_port = 40001 dashboard_user = admin dashboard_pwd = XXXX ``` Caddyfile ``` example.com { proxy /frp/ localhost:40001 { without /frp } } ``` **Steps to reproduce the issue:** 1. 访问https://example.com/frp/ 2. 输入用户名和密码 **Describe the results you received:** 页面被重定向至https://example.com/static/ **Describe the results you expected:** 页面被重定向至https://example.com/frp/static/ **Additional information you deem important (e.g. issue happens only occasionally):** always happen **Can you point out what caused this issue (optional)** dashboard使用`<a href="/static/">Moved Permanently</a>.`重定向,应该使用相对路径static/,后续资源应该使用相对路径访问(static,api等)。 如果使用单一域名反向代理dashboard,问题不会出现。 关于反向代理的使用方法参考 [netdata wiki](https://github.com/firehol/netdata/wiki/Running-behind-caddy)的run netdata in a subfolder。 [caddy反向代理参考文档](https://caddyserver.com/docs/proxy) 该问题应该影响所有web服务器。
Author
Owner

@fatedier commented on GitHub (Jan 17, 2018):

反向代理使用域名来区分网站已经可以了。
个人观点,你想要做 url 路由,那么应该通过自己的方式去完成,比如使用更复杂的配置,甚至自己写代码实现所需的反向代理的功能,而不是要求要反向代理的网站如何去做。一千个人有一千个需求,不可能为了每一个人的需求就去修改正常的功能,也许一个人可以了,其他人又会遇到其他问题。

<!-- gh-comment-id:358343806 --> @fatedier commented on GitHub (Jan 17, 2018): 反向代理使用域名来区分网站已经可以了。 个人观点,你想要做 url 路由,那么应该通过自己的方式去完成,比如使用更复杂的配置,甚至自己写代码实现所需的反向代理的功能,而不是要求要反向代理的网站如何去做。一千个人有一千个需求,不可能为了每一个人的需求就去修改正常的功能,也许一个人可以了,其他人又会遇到其他问题。
Author
Owner

@tufu9441 commented on GitHub (Apr 20, 2018):

@jimstar06 请教一下,如果您不加proxy的without参数,能用Caddy成功反代frp的dashboard页面吗?我试了没有成功,我同一个域名下的/路径反代的是vhost_http_port端口,想再设置一个/frp路径来反代dashboard_port就不行了……

<!-- gh-comment-id:383112698 --> @tufu9441 commented on GitHub (Apr 20, 2018): @jimstar06 请教一下,如果您不加proxy的without参数,能用Caddy成功反代frp的dashboard页面吗?我试了没有成功,我同一个域名下的/路径反代的是vhost_http_port端口,想再设置一个/frp路径来反代dashboard_port就不行了……
Author
Owner

@jimstar06 commented on GitHub (Apr 24, 2018):

子目录反代不成功的原因是访问"example.com/frp"时返回重定向至绝对路径"/static",同时部分资源和api接口在绝对路径"/api"下,服务器需要手动反代这几个路径,我不想这么干

<!-- gh-comment-id:383875410 --> @jimstar06 commented on GitHub (Apr 24, 2018): 子目录反代不成功的原因是访问"example.com/frp"时返回重定向至绝对路径"/static",同时部分资源和api接口在绝对路径"/api"下,服务器需要手动反代这几个路径,我不想这么干
Author
Owner

@tufu9441 commented on GitHub (Apr 24, 2018):

@jimstar06 原来如此,那我也就不折腾这个了。

<!-- gh-comment-id:383876842 --> @tufu9441 commented on GitHub (Apr 24, 2018): @jimstar06 原来如此,那我也就不折腾这个了。
Author
Owner

@owen-gxz commented on GitHub (Jul 13, 2020):

@jimstar06 我80端口被caddy代理到frp上然后本地使用吗?

[common]
bind_port = 22600
vhost_http_port = 22601

我本地需要xxx:22601才可以访问,但是微信那便必须使用80或者443端口才可以这时候怎么来操作

<!-- gh-comment-id:657439393 --> @owen-gxz commented on GitHub (Jul 13, 2020): @jimstar06 我80端口被caddy代理到frp上然后本地使用吗? ``` [common] bind_port = 22600 vhost_http_port = 22601 ``` 我本地需要xxx:22601才可以访问,但是微信那便必须使用80或者443端口才可以这时候怎么来操作
Author
Owner

@weycen commented on GitHub (Feb 11, 2026):

子目录反代不成功的原因是访问"example.com/frp"时返回重定向至绝对路径"/static",同时部分资源和api接口在绝对路径"/api"下,服务器需要手动反代这几个路径,我不想这么干

遇到了同样的问题,好像只能通过端口方式了

<!-- gh-comment-id:3884524379 --> @weycen commented on GitHub (Feb 11, 2026): > 子目录反代不成功的原因是访问"example.com/frp"时返回重定向至绝对路径"/static",同时部分资源和api接口在绝对路径"/api"下,服务器需要手动反代这几个路径,我不想这么干 遇到了同样的问题,好像只能通过端口方式了
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#460
No description provided.