# 401 Unauthorized Error on mvn deploy

**URL:** <https://community.sonatype.com/t/401-unauthorized-error-on-mvn-deploy/5323>\
**Category:** Sonatype Nexus Repository\
**Created:** [November 10, 2020, 1:33pm UTC](https://community.sonatype.com/t/401-unauthorized-error-on-mvn-deploy/5323 "2020-11-10T13:33:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rki](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@rki](https://community.sonatype.com/u/rki)\
**Post date:** [November 10, 2020, 1:33pm UTC](https://community.sonatype.com/t/401-unauthorized-error-on-mvn-deploy/5323/1 "2020-11-10T13:33:50Z")

</div>

Hi, I’m not able to upload a artifact to my nexus instance. The login into Nexus UI is working. The request log shows no user was send, so authentication fails. The two dashes show, no user was send. When I login into the UI a user is logged.

```
123.45.67.8 - - [10/Nov/2020:14:31:03 +0100] "PUT /nexus/repository/thirdparty/org/hibersap/com.sap.conn.jco.sapjco3/3.0.16/com.sap.conn.jco.sapjco3-3.0.16.jar HTTP/1.1" 401 1482224 0 78 "Apache-Maven/3.6.3 (Java 1.8.0_252; Windows 10 10.0)" [qtp2073179777-54]

123.45.67.8 - admin [10/Nov/2020:14:32:23 +0100] "GET /nexus/service/outreach/images/logos/rubygems.png HTTP/1.1" 200 - 8135 14 "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0" [qtp2073179777-168]

```

Why is the user in the settings.xml not send to nexus or ignored?

_Edit_  
When running a curl the user is send sucessfully.  
curl -u user:password [http://123.45.67.8:54080/nexus/repository/thirdparty/org/hibersap/com.sap.conn.jco.sapjco3/3.0.16/com.sap.conn.jco.sapjco3-3.0.16.pom](http://123.45.67.8:54080/nexus/repository/thirdparty/org/hibersap/com.sap.conn.jco.sapjco3/3.0.16/com.sap.conn.jco.sapjco3-3.0.16.pom) --request PUT --data com.sap.conn.jco.sapjco3-3.0.16.pom.xml

---

<div class="post-metadata">

**Author:** ![rseddon](https://yyz1.discourse-cdn.com/flex047/user_avatar/community.sonatype.com/rseddon/32/341_2.png) [@rseddon](https://community.sonatype.com/u/rseddon)\
**Post date:** [November 10, 2020, 7:34pm UTC](https://community.sonatype.com/t/401-unauthorized-error-on-mvn-deploy/5323/2 "2020-11-10T19:34:47Z")

</div>

The “-“ doesn’t mean no user ID was sent, although that is likely the case. The request.log only prints user ID’s for requests where authentication succeeds. See here for things to check regarding this problem:

> **[Troubleshooting Artifact Deployment Failures](https://support.sonatype.com/hc/en-us/articles/213464668-Troubleshooting-Artifact-Deployment-Failures)**
>
> Nexus Repository 2 officially sunsetted June 30, 2025. Visit my.sonatype.com for archived documentation. Migrate to Sonatype Nexus Repository 3 as soon as possible.
> 
> If an artifact fails to deploy ...

---

<div class="post-metadata">

**Author:** ![rki](https://avatars.discourse-cdn.com/v4/letter/r/f4b2a3/32.png) [@rki](https://community.sonatype.com/u/rki)\
**Post date:** [November 11, 2020, 9:44am UTC](https://community.sonatype.com/t/401-unauthorized-error-on-mvn-deploy/5323/3 "2020-11-11T09:44:06Z")

</div>

Thanks @rseddon for the reference. We use a redirect in apache, but maven seems to have a problem with redirects. A curl with the parameter --location-trusted works but the PUT by maven does not.

Solution was to use a ProxyPass not a Redirect, which worked.
