How to ignore idle timeout from AWS ELB in the browser How to ignore idle timeout from AWS ELB in the browser angularjs angularjs

How to ignore idle timeout from AWS ELB in the browser


The issue you have is that an ELB is always going to close the connection unless it gets some traffic back from your server. See below from AWS docs. It's the same behaviour for an ALB or a Classic load balancer.

By default, Elastic Load Balancing sets the idle timeout to 60 seconds for both connections. Therefore, if the instance doesn't send some data at least every 60 seconds while the request is in flight, the load balancer can close the connection. To ensure that lengthy operations such as file uploads have time to complete, send at least 1 byte of data before each idle timeout period elapses, and increase the length of the idle timeout period as needed.

So to get around this, you have two options:

  1. Change the server processing to start sending some data back as soon as the connection is established, on an interval of less than 10 seconds.
  2. Use another library for doing your uploads, or use vanilla javascript. There are plenty of examples out there, e.g. this one.

Edit: Third optionThanks to @colde for making the valid point that you can simply work around your load balancer altogether. This has the added benefit of freeing up your server resources which get tied up with lengthy uploads. In our implementation of this we used pre-signed urls to securely achieve this.