upload blob return Content-Length format error

伟强 黄 20 Reputation points
2024-03-29T07:00:22.35+00:00

I use blob REST api to upload file。

the url like this: https://fanyicunchu.file.core.windows.net/source/1hq3tf4lfw1sgw2aqwec0qm93d4pola4mhw0-896f69966f5b82f2042b3bb6aa9df031/%E6%96%B0%E5%91%98%E5%B7%A5%E5%AF%BC%E5%B8%88%E8%BE%85%E5%AF%BC%E8%AE%A1%E5%88%92%E8%A1%A8-%E5%AE%9E%E6%96%BD.docx

Request Header:

*If-None-Match **

Authorization SharedKey fanyicunchu:xr4hIKJ3jl6drlDuaIs+jGzHEWDxrxLSjwO/igGDTLk=

x-ms-version 2023-08-03

Accept application/xml

Date Fri, 29 Mar 2024 01:34:27 GMT

x-ms-client-request-id 9fad54f8-0c77-424b-a241-c5aed0488388

x-ms-blob-type BlockBlob

Content-Type application/octet-stream

Content-Length 19632

Host fanyicunchu.file.core.windows.net

Connection Keep-Alive

Accept-Encoding gzip

User-Agent okhttp/4.9.3

but it return error like list:

<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.

RequestId:4a8c36cd-f01a-00d5-4e79-819b89000000

Time:2024-03-29T01:34:30.9643255Z</Message><HeaderName>Content-Length</HeaderName><HeaderValue>19632</HeaderValue></Error>

But when I upload the same file to another Blob Account, it successed. Is Blob Server should config something?

360截图20240329103629259 360截图20240329103545467

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,204 questions
0 comments No comments
{count} votes

Accepted answer
  1. Deepanshu katara 17,025 Reputation points MVP Moderator
    2024-03-29T09:13:50.01+00:00

    Hi ,

    There can be several methods for troubleshooting

    Check to ensure that the Date or x-ms-date header is correctly formatted. The format should be in RFC 1123 format: Day, dd MMM yyyy HH:mm:ss GMT.

    When setting metadata for a storage resource, each metadata name-value pair must adhere to certain naming restrictions. The metadata header name must start with prefix x-ms-meta-. The header value should not contain control characters.

    Check if the Content-Length header accurately reflects the size of the payload being sent. If the size is incorrect, it can cause errors.

    Check if the Content-Type and Content-Encoding headers are correct for the data you are sending. For example, if you're sending xml data, your Content-Type should be Content-Type:application/xml

    Kindly accept answer if it helps , Thanks!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.