Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to serve a static page custom page on timeout #1220

Open
allan-simon opened this issue Jun 16, 2022 · 3 comments
Open

Be able to serve a static page custom page on timeout #1220

allan-simon opened this issue Jun 16, 2022 · 3 comments

Comments

@allan-simon
Copy link
Contributor

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" ?

@mnapoli
Copy link
Member

mnapoli commented Jun 16, 2022

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

// Throw an exception so that:
// - this is reported as a Lambda execution error ("error rate" metrics are accurate)
// - the CloudWatch logs correctly reflect that an execution error occurred
// - the 500 response is the same as if an exception happened in Bref
throw new Timeout($timeoutDelayInMs, $context->getAwsRequestId());

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).

@allan-simon
Copy link
Contributor Author

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"

@dhrrgn
Copy link
Contributor

dhrrgn commented Jul 8, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants