Phoenix: New default timeout of 60s in Cowboy 2

Created on 29 Nov 2018  路  2Comments  路  Source: phoenixframework/phoenix

We just upgraded to Cowboy 2 and noticed that some long running requests are cut off at 60s. Reading the Cowboy docs shows up this page: https://github.com/ninenines/cowboy/blob/6cc3b0ccca6c06592c2a1881cae39945de805747/doc/src/manual/cowboy_http.asciidoc

The key option seems to be idle_timeout - any idea how to change this when running Phoenix 1.4 on Cowboy 2.0?

I'm not entirely convinced it's the job of the webserver to be arbitrarily cutting off requests at all, but that's another question.

Most helpful comment

You should be able to config it on your endpoint (though I haven't tested on 1.4)

config :hello, HelloWeb.Endpoint,
  http: [ port: 4000, 
             protocol_options: [idle_timeout: 5_000_000] 
        ],...

try if you can set it as :infinity as well..

maybe all these protocol options (and their defaults) should be added to the docs somewhere..

All 2 comments

You should be able to config it on your endpoint (though I haven't tested on 1.4)

config :hello, HelloWeb.Endpoint,
  http: [ port: 4000, 
             protocol_options: [idle_timeout: 5_000_000] 
        ],...

try if you can set it as :infinity as well..

maybe all these protocol options (and their defaults) should be added to the docs somewhere..

Those are documented here: https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html

I will add a link to the docs. :)

Was this page helpful?
0 / 5 - 0 ratings