Need to override or determine beforehand, the Content-Length Header Setting in a Logic App HTTP action

Evan Wright_admin 0 Reputation points
2023-08-14T19:43:29.09+00:00

The logic app in question retrieves a file attachment, from an email and puts the file in an Azure storage file share. An Office 365 email trigger is used to retrieve the email with the attachment. The file is first initialized by making a call to the Azure Files Create File REST API. If Create File is successful, the content of the file attachment is then added to the initialized file with a call to the Put Range. The problem is that the HTTP action which calls the PUT Range end point, the Content-Length header is automatically whereas the x-ms-range header has to be set in code and is derived from the attachment size property retrieved from the trigger. The x-ms-range header must be in the form x-ms-range:bytes=0-<<content length-1>>, the Content-Length generated by the Action does not match the attachment size property and so an error (status 400) is returned:
<Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.
</Message><HeaderName>Content-Length</HeaderName><HeaderValue>298671</HeaderValue></Error>

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,449 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Urnun 9,856 Reputation points Microsoft Employee
    2023-08-22T22:39:45.83+00:00

    Hello, @Evan Wright_admin - Thanks for reaching out!

    It looks like the Content-* headers are omitted in Logic Apps without showing errors. As such, instead of the HTTP connector to invoke the Azure Files REST API, you can use the Azure File Storage connector and its Create file action.

    0 comments No comments

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.