How to remove headers from proxy response?

I want to remove some of the headers that the 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 that would be possible by adding a simple line to the fly.toml file:

    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 proxy.

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

    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.

1 Like

This may not be implemented properly for machine apps yet.

I am working on porting it atm


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 would implement that to work with all headers.


Have a nice day!

stay tuned. the fix will be released soon Port services.ports.http_options to v2 apps by dangra · Pull Request #2169 · superfly/flyctl · GitHub

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


It finally worked!

Thank you!


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