# Remove traceparent header from http request

**URL:** <https://discuss.elastic.co/t/remove-traceparent-header-from-http-request/329005>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [March 31, 2023, 6:03am UTC](https://discuss.elastic.co/t/remove-traceparent-header-from-http-request/329005 "2023-03-31T06:03:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SleepyF0X](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sleepyf0x/32/119253_2.png) [@SleepyF0X](https://discuss.elastic.co/u/SleepyF0X)\
**Post date:** [March 31, 2023, 6:03am UTC](https://discuss.elastic.co/t/remove-traceparent-header-from-http-request/329005/1 "2023-03-31T06:03:36Z")

</div>

Hello, I have a need in one place where I create an HttpClient and send requests, remove the "traceparent", "tracestate" headers, in other places I want to keep them.  
I tried removing them via DefaultRequestHeaders and also via creating my own DiagnosticListener, the second option was able to remove tracestate but traceparent remains

P.S. I need it because I send a request to a third-party API, which does not want to get these headers

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [April 5, 2023, 7:32am UTC](https://discuss.elastic.co/t/remove-traceparent-header-from-http-request/329005/2 "2023-04-05T07:32:57Z")

</div>

Hi @SleepyF0X , welcome to our forum !

We recently added `disable_outgoing_tracecontext_headers` configuration option in the java agent (and maybe some other agents as well), but that would only disable context propagation as a whole, and I don't know if it's already implemented in dotnet.

You seem to be able to remove the `tracestate` but you are unable to do the same with `traceparent` , is my understanding correct ?  
I am not familiar with the dotnet agent at all, but this behavior seems a bit odd as the HTTP headers are likely written at the same time and with very similar code paths.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 26, 2023, 3:33am UTC](https://discuss.elastic.co/t/remove-traceparent-header-from-http-request/329005/3 "2023-04-26T03:33:37Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
