Request fails after DELETE

Encountered a strange issue with Phoenix. I have a DELETE route in my router:

 delete("/selections/:id", Selections, :delete_nitag_selections_id)

In my handler function, I perform business logic and return a 204:

 TagSelection.Supervisor.delete_selections(namespace_id, [selection_id])

 |> send_resp(204, "No Content")
 |> halt( )

The client successfully receives the response. It keeps the connection open, because it supports keepalive. But the very next request, whatever it is, either gets an error or connection closed prematurely.

I diagnosed that if I have the client send a “Connection: close” header WITH the DELETE request, such that Cowboy closes the connection after sending the response, subsequent responses succeed.

That’s weird. But here’s the really weird part. If I run it locally, in either dev or prod mode, with “iex -S mix phx.server” and have the client connect to it via HTTP, it always works. Requests after a DELETE always succeed.

However, I deploy my application to a container in Amazon ECS and route to it via the Amazon load balancer. In that configuration, all requests use HTTPS, and the failure described above occurs 100% of the time. Requests after a DELETE always fail unless I have the CLIENT send a “Connection: close” header with his DELETE request.

I’m stumped. Any thoughts?

What about deploying it locally as a test? It might just be Amazon doing stuff…

I built the production release using distillery and ran it locally on Mac OSX and it does not show the request-after-DELETE-fails failure. Rats.

Could it be an issue on Linux?

Oh absolutely not, considering almost every web server in existence runs on it, including all of mine. ^.^

Probably some Amazon setting, I don’t use services that I can’t control so I don’t know what to change on it. ^.^;