# HTTP 401 Unauthorized to nexus on HTTPS

**URL:** <https://community.sonatype.com/t/http-401-unauthorized-to-nexus-on-https/10899>\
**Category:** Sonatype Nexus Repository\
**Tags:** nexus-repository\
**Created:** [July 5, 2023, 7:04am UTC](https://community.sonatype.com/t/http-401-unauthorized-to-nexus-on-https/10899 "2023-07-05T07:04:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariusz.brzezik](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mariusz.brzezik](https://community.sonatype.com/u/mariusz.brzezik)\
**Post date:** [July 5, 2023, 7:04am UTC](https://community.sonatype.com/t/http-401-unauthorized-to-nexus-on-https/10899/1 "2023-07-05T07:04:13Z")

</div>

I use Jenkins pipeline to upload artifacts to nexus using HTTPS protocol.  
For some reason, i get 401Unauthorized error since 27.06.2023.  
I was try to figure out the cause, i found that upload on unencrypted plain http works fine:  
https unauthorized requests:

```auto
curl -v -u ${uploader_USR}:${uploader_PSW} --upload-file ListDNSRecords.txt https://nexus.automation.luxmed.pl/repository/binary/
< HTTP/1.1 401 Unauthorized

```

```auto
curl -v -k -H "Authorization: Basic ${auth}" --upload-file /tmp/ListDNSRecords.txt https://nexus.automation.luxmed.pl/repository/binary/ListDNSRecords.txt
< HTTP/1.1 401 Unauthorized

```

Properly authorized http requests:

```auto
curl -v -u ${uploader_USR}:${uploader_PSW} --upload-file ListDNSRecords.txt http://nexus.automation.luxmed.pl/repository/binary/
< HTTP/1.1 201 Created

```

```auto
curl -v -k -H "Authorization: Basic ${auth}" --upload-file /tmp/ListDNSRecords.txt http://nexus.automation.luxmed.pl/repository/binary/ListDNSRecords.txt
< HTTP/1.1 201 Created

```

Download of artifacts with simple curl works fine on both: TLS and unencrypted requests:

```auto
curl -O https://nexus.automation.luxmed.pl/repository/binary/ListDNSRecords.txt
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 57009 100 57009 0 0 1334k 0 --:--:-- --:--:-- --:--:-- 1357k

```

It sugests, that this is not related to TLS handshake error.  
Help You in advance for helping me troubleshoot the cause of the problem!

---

<div class="post-metadata">

**Author:** ![mariusz.brzezik](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mariusz.brzezik](https://community.sonatype.com/u/mariusz.brzezik)\
**Post date:** [July 6, 2023, 8:27am UTC](https://community.sonatype.com/t/http-401-unauthorized-to-nexus-on-https/10899/2 "2023-07-06T08:27:37Z")

</div>

As you could expect, the problem was not with sonatype nexus, but with underlying apache configuration.  
It appeared, that in meantime, someone changed the configuration of proxy, ProxyPreserveHost was set to Off, what caused the problem.  
Thank You for help!
