Cowboy 2 - specify timeout on a per-connection basis

With Phoenix 1.4 now moving us towards Cowboy 2, we also get a default timeout of 60 seconds for a connection.

For most of my endpoints, this is entirely sensible and it seems like a good safety measure.

One of my endpoints, however, streams output as it creates it, and frequently takes considerably more than 60 seconds to finish. I haven’t been able to find a way to increase the timeout on a per-connection basis. The only possibilities I’ve seen relate to changing the settings app-wide.

I think it’s quite common that different endpoints will have wildly different sensible timeouts, yet I haven’t been able to find a documented approach to dealing with this.

5 Likes