# How to remove headers from fly.io proxy response?

**URL:** <https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465>\
**Category:** Questions / Help\
**Tags:** login-only\
**Created:** [April 24, 2023, 4:44pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465 "2023-04-24T16:44:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheDev](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@TheDev](https://community.fly.io/u/TheDev)\
**Post date:** [April 24, 2023, 4:44pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/1 "2023-04-24T16:44:00Z")

</div>

I want to remove some of the headers that the [fly.io](http://fly.io) proxy sends.

I want to remove:

- the ‘via’ header
- the ‘server’ header
- the ‘fly-request-id’ header
- and the ‘x-powered-by’ header

According to this [thread](https://community.fly.io/t/new-feature-basic-http-response-header-modification/3594) that would be possible by adding a simple line to the fly.toml file:

```auto
...
[[services.ports]]
    ...
    http_options = { response = { headers = { via = false, x-powered-by = false, server = false, fly-request-id = false } } }
...

```

But if I deploy this fly.toml file nothing happens. The headers are still send from the [fly.io](http://fly.io) proxy.

---

<div class="post-metadata">

**Author:** ![fideloper-fly](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/fideloper-fly/32/3834_2.png) [@fideloper-fly](https://community.fly.io/u/fideloper-fly)\
**Post date:** [April 24, 2023, 5:40pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/2 "2023-04-24T17:40:41Z")

</div>

Could be a weird toml thing, I’ve had success with this format (watch your white space)

```toml
  [services.ports.http_options.response.headers]
    Via = false
    X-Powered-By = false

```

(I’m not sure if the Fly Proxy ignores this setting for certain headers, such as the request ID - someone can hopefully answer that if it becomes an issue).

Make sure you’re running a `fly deploy` after making any changes here.

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [April 24, 2023, 5:42pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/3 "2023-04-24T17:42:53Z")

</div>

This may not be implemented properly for machine apps yet.

---

<div class="post-metadata">

**Author:** ![dangra](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dangra/32/4413_2.png) [@dangra](https://community.fly.io/u/dangra)\
**Post date:** [April 24, 2023, 6:07pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/4 "2023-04-24T18:07:33Z")

</div>

I am working on porting it atm

---

<div class="post-metadata">

**Author:** ![TheDev](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@TheDev](https://community.fly.io/u/TheDev)\
**Post date:** [April 24, 2023, 6:22pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/5 "2023-04-24T18:22:42Z")

</div>

Thanks for your answers!

I will definitely take a look at @fideloper-fly‘s solution and hope I will have success with it.

I will answer to this topic what my results were.

I would definitely appreciate if [fly.io](http://fly.io) would implement that to work with all headers.

Thanks!

Have a nice day!

---

<div class="post-metadata">

**Author:** ![dangra](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dangra/32/4413_2.png) [@dangra](https://community.fly.io/u/dangra)\
**Post date:** [April 24, 2023, 7:07pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/6 "2023-04-24T19:07:17Z")

</div>

stay tuned. the fix will be released soon [Port services.ports.http\_options to v2 apps by dangra · Pull Request #2169 · superfly/flyctl · GitHub](https://github.com/superfly/flyctl/pull/2169#pullrequestreview-1398598515)

---

<div class="post-metadata">

**Author:** ![dangra](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/dangra/32/4413_2.png) [@dangra](https://community.fly.io/u/dangra)\
**Post date:** [April 24, 2023, 11:32pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/7 "2023-04-24T23:32:37Z")

</div>

Ok, it took longer than expected but here it is, upgrade to flyctl v0.0.541 and redeploy 🚀

---

<div class="post-metadata">

**Author:** ![TheDev](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@TheDev](https://community.fly.io/u/TheDev)\
**Post date:** [April 26, 2023, 1:35pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/8 "2023-04-26T13:35:06Z")

</div>

It finally worked!

Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [May 3, 2023, 1:35pm UTC](https://community.fly.io/t/how-to-remove-headers-from-fly-io-proxy-response/12465/9 "2023-05-03T13:35:07Z")

</div>

Closed on May 3, 2023, 1:35pm UTC

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