You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

输入正确凭证仍返回Unauthorized,Nginx Basic Auth异常求助

问题排查:Nginx Basic Auth异常,后端Undertow返回非预期401

Docker容器内的Nginx代理可正常转发请求到对应服务,但Basic Auth功能出现异常。相关的location代理配置如下:

location /backend_api_v2/swagger.json {
       auth_basic               "Restricted";
       auth_basic_user_file     /etc/nginx/conf.d/nginx.htpasswd;

       proxy_pass               http://${BACKEND_HOST_PORT}/backendAPI/swagger.json;
       proxy_redirect           default;
}
  • 移除auth_basic相关配置后,请求能正常获取Swagger定义;
  • 异常点:返回401的不是Nginx,而是后端的Undertow Realm Security,但该端点本身并不需要认证。

内容的提问来源于stack exchange,提问作者PurryFury

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 06:53:50