New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a feature or option to turn off the Server: tiny-http (Rust)
header
#209
Comments
It will only inject that default header if you haven't set an alternative |
But how can I create a response that without a |
Late answer, but better now than never: let response = response.with_header(tiny_http::Header {
field: "Server".parse().unwrap(),
value: ascii::AsciiString::from_ascii("your-server-name-here").unwrap(),
}); Suggest to close this issue, as this is the way you can set your own value, no feature or option required. |
|
In tiny-http#209 it has been requested to provide a feature to remove the Server HTTP header from responses. You can add now a filter to the response with filter_header(HeaderField). This prevents the header to be sent with the response. All methods adding header stuff to the response now return a Result with HeaderError if the header got not added. For adding multiple headers at once, there is now add_headers(Vec) and with_headers(Vec).
I found that the server built with this project always adds a
Server: tiny-http (Rust)
header to responses and wanted to disable it. At first I guessed that there must be some feature or option at server initialization that would do this, but when I searched through the source code I found nothing that would make adding this header optional.The text was updated successfully, but these errors were encountered: