Skip to content

cargo publish to Artifactory fails with 415 Unsupported Media Type #17086

@ffflorian

Description

@ffflorian

Problem

Hi, we’re seeing a regression with cargo publish against a third-party registry hosted on JFrog Artifactory:
it works with Cargo 1.95.0 but fails with Cargo 1.96.0 with 415 Unsupported Media Type.

This happens when publishing to an Artifactory-backed Cargo registry using a sparse index.

While investigating, I found commit 27cc6bd05889 ("Send a Content-Type header with cargo publish requests").

That commit adds Content-Type: application/octet-stream to the publish request for PUT /api/v1/crates/new. This looks like the most likely cause of the regression.

Was this header change intended as a strict protocol requirement for third-party registries, and is the expectation now that registries must accept application/octet-stream for publish requests?

If helpful, I can provide more detail on the registry setup and logs.

Steps

  1. cargo publish

Possible Solution(s)

No response

Notes

Example config:

 [registry]
 default = "my-registry"
 global-credential-providers = ["cargo:token"]
 
 [registries.my-registry]
 index = "sparse+https://<artifactory-host>/artifactory/api/cargo/<repo>/index/"

Version

cargo 1.96.0 (30a34c682 2026-05-25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions