【问题标题】:Cowboy returns 400 without headers牛仔返回 400 没有标题
【发布时间】:2018-04-02 00:18:09
【问题描述】:

AWS HealthCheck 端点不发送任何导致 Cowboy (v 1.1.2) 返回 400 的标头。这会导致容器重新启动。

有没有办法解决这个问题?

相关github问题:https://github.com/phoenixframework/phoenix/issues/2437

curl 请求重现错误:

   curl http://localhost:4000/ping  -H 'Host:'

日志:

[error] Cowboy returned 400 and there are no headers in the connection.

This may happen if Cowboy is unable to parse the request headers,
for example, because there are too many headers or the header name
or value are too large (such as a large cookie).

You can customize those values when configuring your http/https
server. The configuration option and default values are shown below:

    protocol_options: [
      max_header_name_length: 64,
      max_header_value_length: 4096,
      max_headers: 100
    ]

端点配置:

 config :my_app, MyAppWeb.Endpoint,
   load_from_system_env: true,
   url: [host: System.get_env("MY_HOST"), port: 443],
   force_ssl: [rewrite_on: [:x_forwarded_proto]]

【问题讨论】:

标签: amazon-web-services erlang elixir cowboy


【解决方案1】:

我最终使用以下端点配置运行服务器:

config :my_app, MyAppWeb.Endpoint,
  load_from_system_env: true,
  http: [port: 4000]

问题解决了。

这可能与牛仔在 ELB 后面运行 https 服务器有关。

【讨论】:

    猜你喜欢
    • 2017-11-29
    • 2016-07-19
    • 2020-09-28
    • 2016-08-02
    • 2017-05-16
    • 2013-05-30
    • 2013-06-08
    • 2014-07-17
    • 2019-05-09
    相关资源
    最近更新 更多