mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-04-25 16:55:56 +03:00
[GH-ISSUE #1111] Nginx UI 2.1.0 版本代理路径有后缀登录异常 #6379
Labels
No labels
Q/A
bug
casdoor
dependencies
docker
documentation
duplicate
enhancement
help wanted
invalid
lego
platform:openwrt
platform:windows
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-ui#6379
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @davidche1116 on GitHub (Jun 4, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1111
Describe the bug
在 Nginx UI 2.1.0 版本中,通过 Nginx 反向代理添加路径后缀(如 /nginx/)后,登录功能报“服务器异常”,而直接访问后端端口(9000)或回退至 2.0.2 版本均正常。
To Reproduce
Steps to reproduce the behavior:
Expected behavior
通过代理路径 /nginx/ 应能正常登录,功能与直接访问 127.0.0.1:9000 或 2.0.2 版本一致
理路径下的静态资源(JS/CSS)和 API 请求应正确加载,无会话丢失问题
或者在docker部署的时候,增加配置文件。支持/nginx前缀配置(域名和证书都需要节省,不得已采用这种后缀域名)
Info (please complete the following information):
Additional context
问题根源分析:
1.Cookie 路径不匹配
2.静态资源路径错误:
前端资源(如 JS/CSS)可能使用绝对路径(如 /static/xxx.js),代理后路径变为 /nginx/static/xxx.js,但资源实际位于后端根路径,导致 404 错误。
3.API 请求路径错误:
登录请求可能发送至 /api/login,但代理后路径应为 /nginx/api/login,后端路由不匹配。
临时解决方案:
回退版本:使用 2.0.2 版本可正常工作。
修复建议:
1.动态路径适配:
后端应根据 X-Forwarded-Prefix 头自动调整 Cookie 路径和 API 路由前缀(需 Nginx 配置 proxy_set_header X-Forwarded-Prefix /nginx/;)。
2.前端资源路径兼容
3.新增支持使用WEB_CONTEXT='/nginx'之类的docker环境变量配置
@0xJacky commented on GitHub (Jun 4, 2025):
刚刚,已经修复
@0xJacky commented on GitHub (Jun 4, 2025):
稍后将会发布 v2.1.1
@davidche1116 commented on GitHub (Jun 4, 2025):
看到了。真快