authentication - 将包上传到 Nexus 时出现随机“401 Unauthorized”错误
问题描述
我正在使用 curl 命令将包上传到 Nexus Repo Manager:
例如:
curl -v -u mvn-deploy:password -T a.ear https://nexus.url:8443/repository/release/group/a/12.0.1/a-12.0.1.jar
该命令有时可以正常工作,但有时会因“401 Unauthorized”错误而失败。这让我很困扰,因为失败似乎很随机。使用 Maven 时,我也可以看到相同的随机“401”错误。
这是 curl 的输出:
* Server auth using Basic with user 'mvn-deploy'
> PUT /a.jar HTTP/1.1
> Authorization: Basic bXZuLWRlcGxveTppTXV4UkZDQTQ1TFkzcFQ0S0U3QVB3T2VoZ0o0c0tFLWVVdm5ZRzF6c1NnVw==
> User-Agent: curl/7.29.0
> Host: nexus.url:8443
> Accept: */*
> Content-Length: 74538424
> Expect: 100-continue
>
< HTTP/1.1 401 Unauthorized
< Date: Mon, 31 May 2021 12:55:14 GMT
< Strict-Transport-Security: max-age=7776000
< Server: Nexus/3.29.2-02 (PRO)
< X-Content-Type-Options: nosniff
* Authentication problem. Ignoring this.
< WWW-Authenticate: BASIC realm="Sonatype Nexus Repository Manager"
< Connection: close
<
{ [data not shown]
解决方案
推荐阅读
- email - 如何在 OroCRM 中使用电子邮件模板文件和样式化电子邮件
- angular - 如何使用 Angular CLI 命令和运行 ng add --help 和 oops
- python - 遍历来自 matplotlib 的子图
- c++ - 为什么需要复制构造函数?它们在哪些情况下非常有用?
- ajax - AJAX 调用异步返回的 VUE.js 问题值
- spring - 如何将我的自定义 ProviderManager 注入 AuthenticationManagerBuilder
- url - 如何复制我在 Firefox 中打开的选项卡的 URL?
- junit - 如何使用 JUnit RunWith 修复语法错误
- python - 在 Djnago 管理员中如何允许在 Inline 部分中仅添加一个对象?
- angular - 将 formGroupName 传递给子组件