# How to disable tracestate and traceparent headers

**URL:** <https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164>\
**Category:** APM\
**Tags:** java\
**Created:** [January 28, 2023, 5:14pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164 "2023-01-28T17:14:06Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![e03c5fccb551b6833a65](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e03c5fccb551b6833a65/32/116444_2.png) [@e03c5fccb551b6833a65](https://discuss.elastic.co/u/e03c5fccb551b6833a65)\
**Post date:** [January 28, 2023, 5:14pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/1 "2023-01-28T17:14:06Z")

</div>

One of our services connects to a bank, and the requests are getting blocked because of these additional headers. Is there a way to disable them.

I tried setting the **use\_elastic\_traceparent\_header** property to false, but the headers are still present in every **API** call.

Currently the request are made using spring rest client.

APM Agent Version: 1.28.1  
Language : Java

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 29, 2023, 4:15am UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/2 "2023-01-29T04:15:16Z")

</div>

Hi @e03c5fccb551b6833a65

Hmmm looking.

> [@e03c5fccb551b6833a65](#):
>
> use\_elastic\_traceparent\_header

Yes that is not the correct setting, that just just add a header for backwards compatibility.

I thought there was a setting to stop the outbound headers...but I don't see it...

We will see if we get any other help.

@Eyal_Koren Any thoughts, I was asked recently about this as well...

---

<div class="post-metadata">

**Author:** ![e03c5fccb551b6833a65](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e03c5fccb551b6833a65/32/116444_2.png) [@e03c5fccb551b6833a65](https://discuss.elastic.co/u/e03c5fccb551b6833a65)\
**Post date:** [January 29, 2023, 5:05am UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/3 "2023-01-29T05:05:59Z")

</div>

Thank you for the reply. I hope there is some way.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 29, 2023, 1:25pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/4 "2023-01-29T13:25:45Z")

</div>

There is no way to disable those at the moment.  
It's easy to add such basic functionality, however I doubt that having the ability to completely disable trace context headers would be very useful. More likely this will be useful to be done only for specific destinations, and this is a bit more tricky to get right.

Harshith, what exactly would you want to be able to do? Is completely disabling the addition of outgoing headers useful in your case? This means that distributed tracing won't be supported for any outgoing communication from this service. Alternatively, what kind of destination information would be useful for you, for example - destination hostname? Something else?

---

<div class="post-metadata">

**Author:** ![e03c5fccb551b6833a65](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e03c5fccb551b6833a65/32/116444_2.png) [@e03c5fccb551b6833a65](https://discuss.elastic.co/u/e03c5fccb551b6833a65)\
**Post date:** [January 29, 2023, 4:26pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/5 "2023-01-29T16:26:38Z")

</div>

@Eyal_Koren The problem is that it's very hard to convince banks to accept these headers, mostly impossible. We don't use the distributed tracing functionality, so we would need some mechanism to disable these headers.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 29, 2023, 4:54pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/6 "2023-01-29T16:54:21Z")

</div>

OK, let me discuss this with the team and get back to you.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 30, 2023, 10:33am UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/7 "2023-01-30T10:33:29Z")

</div>

Following up on this - we discussed this option.  
What we are currently thinking is:

- adding a `boolean` config to disable headers injection on **all outgoing requests** , which means losing the distributed tracing capability on all downstream services (not affecting the ability to connect the transaction of the configured service with the upstream parts of the trace)
- we currently think that having the ability to configure something similar only for specific outgoing communication may be an overkill, so if this need arises, the workaround would be to set up a proxy that strips off unwanted headers where required

@stephenb you said you were recently asked about this, do think this would be useful?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 30, 2023, 2:38pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/8 "2023-01-30T14:38:28Z")

</div>

@Eyal_Koren Yes I think this is a reasonable solution.

What I was asked about was the nearly identical to the use case the OP describes.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 31, 2023, 8:34am UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/9 "2023-01-31T08:34:23Z")

</div>

Thanks for confirming! 🙏  
OK then, I will add such option and share here for testing.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 31, 2023, 9:30am UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/10 "2023-01-31T09:30:09Z")

</div>

@e03c5fccb551b6833a65 Please replace your current Java agent with [this snapshot](https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-java%2Fapm-agent-java-mbp/detail/PR-2996/1/artifacts), add the new configuration option `disable_outgoing_tracecontext_headers=true` and let me know if this solved the issue for you.

---

<div class="post-metadata">

**Author:** ![e03c5fccb551b6833a65](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e03c5fccb551b6833a65/32/116444_2.png) [@e03c5fccb551b6833a65](https://discuss.elastic.co/u/e03c5fccb551b6833a65)\
**Post date:** [January 31, 2023, 3:32pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/11 "2023-01-31T15:32:50Z")

</div>

Thank you so much for the quick support 🙏 . The config is working as expected.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 31, 2023, 3:36pm UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/12 "2023-01-31T15:36:17Z")

</div>

WOW What service from @Eyal_Koren!!!

Thanks @e03c5fccb551b6833a65 for your time, use case, and testing...

---

<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:** [February 21, 2023, 11:36am UTC](https://discuss.elastic.co/t/how-to-disable-tracestate-and-traceparent-headers/324164/13 "2023-02-21T11:36:38Z")

</div>

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