Getting invalid header name when using putFileRange to write to the file in the azure server

rodolfo tuble 1 Reputation point
2020-06-18T06:37:42.61+00:00

the system that creates/writes the file to the Azure is hosted in ubuntu 18.04.6.

The file is successfully created in the Azure File Storage, but when it's time to write to the file using putFileRange, I'm getting the error below:

Also, this code works fine if I execute it from my local windows machine. We've also already added in the appropriate credentials needed by the ubuntu system to connect to the Azure File Storage

/etc/smbcredentials <- for the mounting and credentials

Also, the mounting process mentioned that the OS must support SMB 3.0. Not really sure what that is

Fail:
Code: 400
Value: Bad Request
details (if any): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</BODY></HTML>
. {"exception":"[object] (MicrosoftAzure\Storage\Common\Exceptions\ServiceException(code: 400): Fail:
Code: 400
Value: Bad Request
details (if any): <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD>
<BODY><h2>Bad Request - Invalid Header</h2>
<hr><p>HTTP Error 400. The request has an invalid header name.</p>
</BODY></HTML>
. at /var/www/tt/vendor/microsoft/azure-storage-common/src/Common/Internal/ServiceRestProxy.php:490)

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,227 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sumarigo-MSFT 45,491 Reputation points Microsoft Employee
    2020-06-23T10:40:09.437+00:00

    @odolfotuble-4323, Firstly, apologies for the delay in responding here and any inconvenience this issue may have caused.

    Just for better understanding the issue: Can you please verify the Prerequisites . The recommended way to mount an Azure file share on Linux is using SMB 3.0. By default, Azure Files requires encryption in transit, which is only supported by SMB 3.0. Azure Files also supports SMB 2.1, which does not support encryption in transit, but you may not mount Azure file shares with SMB 2.1 from another Azure region or on-premises for security reasons. Unless your application specifically requires SMB 2.1, there is little reason to use it since most popular, recently released Linux distributions support SMB 3.0.

    Also check value of x-ms-range, Content-Length and Date Format .

    This article lists common problems that are related to Azure Files when you connect from Linux clients. It also provides possible causes and resolutions for these problems: https://learn.microsoft.com/en-us/azure/storage/files/storage-troubleshoot-linux-file-connection-problems

    The 400 Bad Request Error is an HTTP response status code that indicates that the server was unable to process the request sent by the client due to invalid syntax.

    You can also check Put Range

    Hope this helps!

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.