Skip to content

azurestore: InvalidHeaderValue during upload in v2.9.1+ #1358

@LincolnG4

Description

@LincolnG4

Describe the bug
In version v2.9.1+, uploads to Azure Blob Storage fail on:

// Stage an empty sentinel block so that "no uncommitted blocks" reliably means upload complete.
// Without it we cannot distinguish completed uploads from a new upload that has not written any blocks yet.
// Committed blocks exist if versioning is enabled and a blob is overwritten.
if err := azUpload.BlockBlob.Upload(ctx, bytes.NewReader([]byte{})); err != nil {
	return nil, err
}

This problem was introduced in PR #1349 . The azurestore package attempts to upload an empty sentinel block to mark the upload as complete, but Azure returns a 400 Bad Request claiming the Content-Length: 0 header is invalid.

returning

26/03/27 10:23:08 ERROR InternalServerError method=POST path="" requestId="" message="PUT https://acctustesting.blob.core.windows.net

test/0d2e9ec8684534db414b70e83fe71a20\n--------------------------------------------------------------------------------\nRESPONSE 400: 400 The value for one of the HTTP headers is not in the correct format.\nERROR CODE: 
InvalidHeaderValue\n--------------------------------------------------------------------------------\n\ufeff<?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:5a9ba995-601e-0037-28cb-  bdd7d8000000\nTime:2026-03-27T09:23:08.5748584Z</Message><HeaderName>Content-Length</  HeaderName><HeaderValue>0</HeaderValue></Error>\n--------------------------------------------------------------------------------\n"

If I remove this zero upload block or change the size of the block, the upload works normally.

To Reproduce
Steps to reproduce the behavior:
tusd version: v2.9.1+
Storage Provider: Azure Blob Storage

azConfig := &azs.AzConfig{
		AccountName:         "", //hided
		AccountKey:          "", // hided
		ContainerName:       "test",
		BlobAccessTier:      "hot",
		Endpoint:            "https://hide.blob.core.windows.net",
		ContainerAccessType: "private",
	}
  1. Configure tusd to use the azurestore backend.
  2. Attempt to upload a file.
  3. The server logs an InternalServerError during the finalization step.

Expected behavior
The upload should complete successfully.

Setup details
Please provide following details, if applicable to your situation:

  • Operating System: Linux
  • Used tusd version: v2.9.2
  • Used tusd data storage: Azure Blob Storage
  • Used tusd configuration:
tusHandler, err := tHandler.NewHandler(tHandler.Config{
		BasePath:                "/files/",
		StoreComposer:           composer,
		NotifyCompleteUploads:   true,
		NotifyTerminatedUploads: true,
		NotifyUploadProgress:    true,
		DisableDownload:         true,
		RespectForwardedHeaders: false,
	})
  • Used tus client library: tusd golang

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions