- Newest
- Most votes
- Most comments
The issue you're experiencing with CloudFront timing out at around 90 seconds when connecting to your Application Load Balancer (ALB) is a known limitation. CloudFront has a default timeout of 60 seconds for requests to origins, which can be extended up to 60 minutes for custom origins. However, when using an ALB as an origin, CloudFront doesn't automatically inherit the ALB's timeout settings.
To address this, you have a few options:
-
Request a timeout increase: You can contact AWS Support to request an increase in the CloudFront timeout for your ALB origin. This is likely the most straightforward solution if you need to maintain long-running connections.
-
Optimize your application: If possible, try to optimize your application to complete requests within the CloudFront timeout period. This might involve breaking down long-running operations into smaller chunks or implementing a polling mechanism.
-
Use a custom origin: If feasible, you could consider setting up a custom origin instead of using the ALB directly. This would allow you to configure longer timeouts (up to 60 minutes) directly in CloudFront.
-
Implement a keep-alive mechanism: You could implement a client-side keep-alive mechanism to maintain the connection, periodically sending small requests to prevent the timeout.
-
Use WebSockets: If your application supports it, WebSocket connections can be maintained for longer periods and might be a suitable alternative for long-running operations.
It's important to note that while the ALB supports longer timeouts, CloudFront is designed to handle shorter, more typical web request durations. For scenarios requiring very long-running connections, you might need to reconsider your architecture or implement one of the alternatives mentioned above.
If you decide to request a timeout increase from AWS Support, be prepared to provide details about your use case and why you need the extended timeout period. They may be able to offer additional guidance or solutions specific to your situation.
Sources
Resolve HTTP connection errors with Application Load Balancer | AWS re:Post
AWS Application Load Balancer announces CloudFront integration with built-in WAF - AWS
Introducing Amazon CloudFront VPC origins: Enhanced security and streamlined operations for your applications | AWS News Blog
Relevant content
asked 3 years ago
asked 4 years ago
