在Akka HTTP响应中放置标头

时间:2019-05-10 09:40:00

标签: akka-http

我正在使用Akka HTTP 10.0.15。每个响应都包含标题Server: akka-http/10.0.15。有什么方法可以删除此标头吗?我在指令列表中找不到任何内容。

1 个答案:

答案 0 :(得分:1)

在您的application.conf中,将akka.http.server.server-header设置为空字符串:

akka.http.server.server-header = ""

来自reference configuration

akka.http {

  server {
    # The default value of the `Server` header to produce if no
    # explicit `Server`-header was included in a response.
    # If this value is the empty string and no header was included in
    # the request, no `Server` header will be rendered at all.
    server-header = akka-http/${akka.http.version}

    ...
  }

  ...
}