2017-10-20 8 views
0

AWS HealthCheckエンドポイントは、Cowboy(v 1.1.2)が400を返す原因となるヘッダを送信しません。これによりコンテナが再起動します。Cowboyがヘッダなしで400を返す

問題を回避する方法はありますか?

関連githubの問題:エラーを再現するhttps://github.com/phoenixframework/phoenix/issues/2437

カール要求:

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]] 
+1

HTTPプロトコルでホストヘッダーが必要です。https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host – narrowtux

答えて

0

次​​のエンドポイント設定でサーバーを実行しました。

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

この問題は解決されました。

おそらく、カウボーイがELBの後ろにhttpsサーバを稼働させていたということが関係していました。

関連する問題