Allow to remove the version string in HTTP responses.
Normally Unit responds to HTTP requests by including a header like
Server: Unit/1.30.0
however it can sometimes be beneficial to withhold the version
information and in this case just respond with
Server: Unit
This patch adds a new "settings.http" boolean option called
server_version, which defaults to true, in which case the full version
information is sent. However this can be set to false, e.g
"settings": {
"http": {
"server_version": false
}
},
in which case Unit responds without the version information as the
latter example above shows.
Link: <https://www.ietf.org/rfc/rfc9110.html#section-10.2.4>
Closes: <https://github.com/nginx/unit/issues/158>
Reviewed-by: Alejandro Colomar <alx@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
@@ -1519,6 +1519,12 @@ static nxt_conf_map_t nxt_router_http_conf[] = {
|
||||
NXT_CONF_MAP_INT8,
|
||||
offsetof(nxt_socket_conf_t, log_route),
|
||||
},
|
||||
|
||||
{
|
||||
nxt_string("server_version"),
|
||||
NXT_CONF_MAP_INT8,
|
||||
offsetof(nxt_socket_conf_t, server_version),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1927,6 +1933,8 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
|
||||
skcf->proxy_send_timeout = 30 * 1000;
|
||||
skcf->proxy_read_timeout = 30 * 1000;
|
||||
|
||||
skcf->server_version = 1;
|
||||
|
||||
skcf->websocket_conf.max_frame_size = 1024 * 1024;
|
||||
skcf->websocket_conf.read_timeout = 60 * 1000;
|
||||
skcf->websocket_conf.keepalive_interval = 30 * 1000;
|
||||
|
||||
Reference in New Issue
Block a user