[GH-ISSUE #3799] nginx代理客户端通过域名访问提示请求的资源[/static/]不可用 #3024

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

Originally created by @xydfg on GitHub (Nov 25, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3799

Bug Description

在内网安装客户端之后,通过nginx配置代理,用域名访问,提示static静态资源不可用,或者在客户端配置tcp同样无法通过公网的ip访问内网客户端的管理页面

frpc Version

0.51.3

frps Version

0.51.3

System Architecture

linux/amd64

Configurations

image
在客户端已经配置了代理到内网管理页面的地址,但通过remote_addres这个地址无法访问

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 @xydfg on GitHub (Nov 25, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3799 ### Bug Description 在内网安装客户端之后,通过nginx配置代理,用域名访问,提示static静态资源不可用,或者在客户端配置tcp同样无法通过公网的ip访问内网客户端的管理页面 ### frpc Version 0.51.3 ### frps Version 0.51.3 ### System Architecture linux/amd64 ### Configurations ![image](https://github.com/fatedier/frp/assets/60249331/320a108f-0c3b-4dcc-9c97-85dbbd30c83e) 在客户端已经配置了代理到内网管理页面的地址,但通过remote_addres这个地址无法访问 ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [X] Test and Release - [x] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [X] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:57:17 -06:00
Author
Owner

@xqzr commented on GitHub (Nov 25, 2023):

提供 Ngx 配置

<!-- gh-comment-id:1826415272 --> @xqzr commented on GitHub (Nov 25, 2023): 提供 Ngx 配置
Author
Owner

@xydfg commented on GitHub (Nov 26, 2023):

提供 Ngx 配置
这个为内网服务nginx的配置 其他配置均可以通过公网ip访问,唯独这个不行

image

<!-- gh-comment-id:1826479950 --> @xydfg commented on GitHub (Nov 26, 2023): > 提供 Ngx 配置 这个为内网服务nginx的配置 其他配置均可以通过公网ip访问,唯独这个不行 ![image](https://github.com/fatedier/frp/assets/60249331/20888b4f-796a-4435-a467-1e0826a37d26)
Author
Owner

@xqzr commented on GitHub (Nov 26, 2023):

提供 Ngx 配置

这个为内网服务nginx的配置 其他配置均可以通过公网ip访问,唯独这个不行

image

:6200/static/;

<!-- gh-comment-id:1826772860 --> @xqzr commented on GitHub (Nov 26, 2023): > > 提供 Ngx 配置 > > 这个为内网服务nginx的配置 其他配置均可以通过公网ip访问,唯独这个不行 > > ![image](https://private-user-images.githubusercontent.com/60249331/285627566-20888b4f-796a-4435-a467-1e0826a37d26.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDEwMDEwMDcsIm5iZiI6MTcwMTAwMDcwNywicGF0aCI6Ii82MDI0OTMzMS8yODU2Mjc1NjYtMjA4ODhiNGYtNzk2YS00NDM1LWE0NjctMWUwODI2YTM3ZDI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzExMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMTI2VDEyMTE0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJiYjU0YTg5ZDg5ODkyYjE3MWY5MDZlNzMwOGE2YmYzNmZjNzA2NDczOTk2MmQyM2U4NDhiNzU4OTZkYzAxMWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.40AvBdTJIuX3HLNQj5H4eWxXNBeBMbsidJIr29Y_t_U) `:6200/static/;`
Author
Owner

@xydfg commented on GitHub (Nov 26, 2023):

提供 Ngx 配置

这个为内网服务nginx的配置 其他配置均可以通过公网ip访问,唯独这个不行
图像

:6200/static/;

还是不行用域名访问地址被重定向到static
image

<!-- gh-comment-id:1826780854 --> @xydfg commented on GitHub (Nov 26, 2023): > > > 提供 Ngx 配置 > > > > > > 这个为内网服务nginx的配置 其他配置均可以通过公网ip访问,唯独这个不行 > > ![图像](https://private-user-images.githubusercontent.com/60249331/285627566-20888b4f-796a-4435-a467-1e0826a37d26.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTEiLCJleHAiOjE3MDEwMDEwMDcsIm5iZiI6MTcwMTAwMDcwNywicGF0aCI6Ii82MDI0OTMzMS8yODU2Mjc1NjYtMjA4ODhiNGYtNzk2YS00NDM1LWE0NjctMWUwODI2YTM3ZDI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFJV05KWUFYNENTVkVINTNBJTJGMjAyMzExMjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjMxMTI2VDEyMTE0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJiYjU0YTg5ZDg5ODkyYjE3MWY5MDZlNzMwOGE2YmYzNmZjNzA2NDczOTk2MmQyM2U4NDhiNzU4OTZkYzAxMWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.40AvBdTJIuX3HLNQj5H4eWxXNBeBMbsidJIr29Y_t_U) > > `:6200/static/;` 还是不行用域名访问地址被重定向到static ![image](https://github.com/fatedier/frp/assets/60249331/0710420f-02ba-4be2-bba1-5629dd68e5bc)
Author
Owner

@github-actions[bot] commented on GitHub (Dec 27, 2023):

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

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

@lucienshawls commented on GitHub (Mar 19, 2024):

尝试对你的nginx配置进行修改,使得对/static/xxx的请求被重写至/dfg/frps/static/xxx,然后被重写后的URL触发代理转发规则,使得/dfg/frps/后的uristatic/xxx被代理转发至dashboard.

引发错误的主要原因是dashboard将static的uri写死为绝对路径/static,即无论nginx配置如何,dashboard必定会尝试访问xxx.example.com/static,而此URL无法命中代理转发规则location /dfg/frps,nginx又没有配置location /static/,导致请求无法被代理到http://localhost:port/,就404了。

server {
        # 代理转发
        location /dfg/frps/ {
                proxy_pass http://localhost:6200/;
        }
        # URL重写
        location /static/ {
                rewrite ^ $scheme://$host/dfg/frps$uri;
        }
}

进行此变更的唯一代价是,你不能配置xxx.example.com/static网页了,因为请求会被转走。

<!-- gh-comment-id:2006064507 --> @lucienshawls commented on GitHub (Mar 19, 2024): 尝试对你的nginx配置进行修改,使得对`/static/xxx`的请求被重写至`/dfg/frps/static/xxx`,然后被重写后的URL触发代理转发规则,使得`/dfg/frps/`后的uri`static/xxx`被代理转发至dashboard. 引发错误的主要原因是dashboard将`static`的uri写死为绝对路径`/static`,即无论nginx配置如何,dashboard必定会尝试访问`xxx.example.com/static`,而此URL无法命中代理转发规则`location /dfg/frps`,nginx又没有配置`location /static/`,导致请求无法被代理到`http://localhost:port/`,就404了。 ```config server { # 代理转发 location /dfg/frps/ { proxy_pass http://localhost:6200/; } # URL重写 location /static/ { rewrite ^ $scheme://$host/dfg/frps$uri; } } ``` 进行此变更的唯一代价是,你不能配置`xxx.example.com/static`网页了,因为请求会被转走。
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#3024
No description provided.