web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Http-Status 400 Bad Request due to long "correlation-context"-header at requests with HttpClient

(2) ShareShare
ReportReport
Posted on by 4

For our AL add-ons, we use some external services with REST endpoints. The requests are executed natively via Microsoft’s implementation of the HttpClient type.

For some requests, we receive an HTTP status 400 “Bad Request”.
In one case, the request even worked as an interactive process, but the same request returned “Bad Request” when executed via a job queue entry.

After some research, it became clear that the cause is the sometimes very long "correlation-context" header, which—when sending via HttpClient—appears to be injected by Microsoft before the request is sent.
It contains information about the context of the call, including the client, the object, parameters related to job queue entries, IDs, etc. Therefore, its length can vary. In a SaaS environment, it's even longer.

Some of the REST endpoints seem to have a length limit for HTTP headers. For example, if a header is longer than 300 characters, a “Bad Request” is returned. If the header is shorter, the request goes through.
We were able to reproduce this using Postman.

And now the actual question:
Is it possible to prevent this automatic injection of the "correlation-context" header? Or is there a publisher/hook that allows removing the header again before sending?

Thanks for any hints.
I have the same question (0)
  • Suggested answer
    Dhiren Nagar Profile Picture
    473 on at
    Hi,
     
    You can use HttpClient and HttpHeaders to remove certain Headers which you do not want to send as a request.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,585

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 780 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 712 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans