uv: `uv pip install` with Nexus give "Missing 'Content-Type"` error

uv version is 0.1.5 on Ubuntu 20.04, python 3.10

With UV_INDEX_URL pointing to a private Sonatype Nexus service acting as a pypi proxy:

$ uv pip install gcsfs
error: Missing `Content-Type` header for https://****:****@nexus.example.com/repository/pypi-group/simple/gcsfs/

Hitting the above URL with curl -v shows a content type header of "text/html; charset=UTF-8" is returned

$ curl -o x -v https://******:******@nexus.example.com/repository/pypi-group/simple/gcsfs/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying x.x.x.x:443...
* TCP_NODELAY set
* Connected to nexus.example.com (x.x.x.x) port 443 (#0)
<snip>
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
} [5 bytes data]
* Server auth using Basic with user '*****'
* Using Stream ID: 1 (easy handle 0x55a8e6d03680)
} [5 bytes data]
> GET /repository/pypi-group/simple/gcsfs/ HTTP/2
> Host: nexus.example.com
> authorization: Basic ****************** 
> user-agent: curl/7.68.0
> accept: */*
> 
<snip>
< HTTP/2 200 
< content-type: text/html; charset=UTF-8
< content-length: 24690
< date: Tue, 20 Feb 2024 14:11:26 GMT
< server: Nexus/3.48.0-01 (OSS)
< x-content-type-options: nosniff
< content-security-policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
< x-xss-protection: 1; mode=block
< last-modified: Tue, 20 Feb 2024 13:59:16 GMT
< 
{ [16048 bytes data]
100 24690  100 24690    0     0  84554      0 --:--:-- --:--:-- --:--:-- 84845
* Connection #0 to host nexus.example.com left intact

Last week I tested uv v0.1.2 in the same environment and it rejected md5 hashes, but pandas was one package that had no issue. Now with v0.1.5 pandas and many others have the Content-Type issue but there are still some packages that will install via Nexus, such as aiohttp. I can’t detect any difference in the HTTP responses from Nexus between the packages that work and those that don’t. All have Content-Type of “text/html; charset=UTF-8”. Comparing against http://pypi.org/simple/<package>/, it appears pypi sets the Content-Type header to “text/html” (no charset specified).

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 2
  • Comments: 29 (16 by maintainers)

Commits related to this issue

Most upvoted comments

If that helps … I have the issue too with a Nexus repo, latest uv version. --no-cache fixes the issue (but is slower). curl shows that a Content-Type header is provided

I still see the issue arise in uv 0.1.11