bref icon indicating copy to clipboard operation
bref copied to clipboard

Be able to serve a static page custom page on timeout

Open allan-simon opened this issue 3 years ago • 3 comments

AWS ALB's can be used as a frontend load balancer for lambda,

BUT they have a drawbacks which is that they don't have the possibility to customize 502 error page

As Bref has a little extra window , would it make sense to be able to configure it to return its own "timeout" response, so that users don't see a blank page with just written "502" ?

allan-simon avatar Jun 16 '22 15:06 allan-simon

Oh, that's an interesting idea, but then we would loose the invocation being reported as an error:

https://github.com/brefphp/bref/blob/bdf833131d035d77d473d89b8c901688916fc2d8/src/Event/Http/FpmHandler.php#L147-L151

With API Gateway we can customize the responses to achieve that, but yeah, with ALB you seem to be out of luck :/ I'm not sure we want to an such an option just for ALB, especially since that option goes against the Lambda behavior (mark the invocation as failed via an error = no response).

mnapoli avatar Jun 16 '22 15:06 mnapoli

hmmm maybe I need to reconsider why I choose ALB instead of API Gateway

https://dashbird.io/blog/aws-api-gateway-vs-application-load-balancer/

I may have mistakenly think "ALB is less capable than API Gateway, so it will be less expensive"

allan-simon avatar Jun 16 '22 18:06 allan-simon

A little late here, but you could put a CloudFront distribution in front of your ALB and add a custom error page for 502/504 statuses to that origin.

dhrrgn avatar Jul 08 '22 10:07 dhrrgn