如何禁用 WEBrick 服务器标头
我用 Ruby 开发了一个 Web 应用程序(如果重要的话,使用 Sinatra 框架)。
它向每个 HTTP 响应添加一个 Server
标头:
Server: WEBrick/1.3.1 (Ruby/1.9.3/2011-09-23)
如何禁用它?
I've developed a web application in Ruby (using Sinatra framework if that matters).
It adds a Server
header to every HTTP response:
Server: WEBrick/1.3.1 (Ruby/1.9.3/2011-09-23)
How do I disable it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您是否可以在不破坏内容的情况下完全删除
Server
标头。我认为更简单的是删除此标头的所有内容,如下所示:如果您想为每个操作准备此操作,您可以使用
before
过滤器:I'm not sure that you can delete
Server
header at all without hacking the guts. I think that more simple is delete all content of this header such way:If you want to prepare this manipulation for each action, you can use
before
filter: