I am trying to remove the server information from the http response header in my ruby on rails application running on Heroku but I am stuck. Inspecting the response headers gives me:
Server:thin 1.5.0 codename Knife
Can anyone point me in the right direction?
This Server header is set by the Thin server when assembling the response. A recent commit adds the ability to set the Server to something else, but it doesn’t look like you can totally remove it.
One thing you can do is to set the value of the Thin::VERSION contsant to nil, which results in no Server header being sent:
Thin.send :remove_const, :SERVER
Thin::SERVER = nil
The first line is to avoid the warning that would be generated when altering a constant. Now when Thin tries to set the Server header it sees it is nil and skips it, so no header is set at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With