-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为项目后端配置反向代理时,静态文件和 API 请求无法正确转发 #520
Comments
我们之前针对这种情况做过调整了 #68 只需要改成 location /nginxui/ (后面加个 / )就可以正常使用,对了,记得配置 WebSocket 相关。 Example:
|
@0xJacky Thank you. Worked for me! |
Sorry I can't, we need this block to set up a condition where a normal HTTP request will not upgrade to a WebSocket connection. |
@0xJacky I tested this and seems everything works: location /nginx-ui/ {
proxy_pass http://127.0.0.1:9000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
} The line |
Is your feature request related to a problem? Please describe.
我希望配置通过域名(如 https://example.com/nginxui )访问服务,我为此配置了反向代理
但这样做的话,许多静态文件和 API 请求无法正确转发到后端服务器。这导致呈现空白页,功能无法正常使用。
我也尝试将静态文件的
/assets/
路径 和/api/
路径配置转发至http://127.0.0.1:9000
的对应路径,但我觉得这样可能存在某些潜在的问题,且似乎有些“不优雅”。我查阅了项目文档,并没有找到相关说明。如果该功能已实现,烦请告知如何操作。
Describe the solution you'd like
我希望项目能够支持通过自定义子路径进行反向代理访问。例如,在 Nginx 中配置 /nginxui 作为子路径,能让所有相关请求(包括静态文件和 API 请求)正确转发到后端。
Describe alternatives you've considered
目前我尝试过使用不同的 Nginx 反向代理配置,然而问题依然存在。我认为项目需要内置对自定义子路径的支持,或者提供一个更清晰的指导来帮助用户解决这一问题。
Additional context
Nginx-UI
是非常优秀的项目,感谢作者大大的付出!The text was updated successfully, but these errors were encountered: