Load balancer custom error page

0

Hello. When the backend is down I see a 502 or 503 error page. I want to change it for my own HTML code. I know that I can do it using 3 solutions:

  • DNS failover
  • CloudFront
  • LB rule In this case, I prefer a fast and free solution like the Load Balancer rule. Today I tried to implement a Fixed response. Unfortunately, It is manual action (so I should turn the rule ON or OFF) to use it. So how to implement automatically switching "503" page to my own, or switch to custom HTML code in the rule? I do not know what condition features I should add to the rule.

I expect the first rule like this: if the request code is 503 then use my custom code.

  • Hi KonstantinZ, Could you describe the setup in a little more detail. Do you mean response code 503? How/why is the request code 503?

    I am presuming some backend (which is behind the app load balancer ??) is down and you want to send a custom error page/html code?

質問済み 1年前4568ビュー
3回答
0

To respond with customer error page and override default response with a custom one you can use Amazon API Gateway or Amazon CloudFront as this functionality is available out of the box.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-gatewayResponse-definition.html#supported-gateway-response-types

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/GeneratingCustomErrorResponses.html

As for the using the Application load balancer, firstly need to understand your setup. I have attached here a diagram based off of my understanding of your current setup (2 versions) and possible solutions. Happy to discuss more.

Enter image description here

AWS
回答済み 1年前
0

Thank you for your answer. I have a conversation with the developers and we are decided to implement custom page 503 using S3 + CloudFront. In this case, I have an issue and ask you to help me.

So I have LoadBalancer dev-alb which is attached to Route53. Due to the Youtube tutorial, I created an S3 bucket and distributed CloudFront to this S3 bucket. Then I realized that something went wrong and changed my S3 bucket for another tutorial from re:Post Now my bucket has no public access and CloudFront has Origin Access.

I stopped 2 tasks BE and FE to see custom error 503, but unfortunately, I see the standard message. I'm confused because all tutorials have their own peculiarity.

I need:

  • Using my LoadBalancer
  • I stop BE and FE tasks
  • User sees my custom error 503 (I uploaded it to my S3 yet)

Maybe I should distribute CloudFriont to my LoadBalancer instead S3?

回答済み 1年前
0

Also, I re-check information from this suggestion. My consequence next:

  1. Create non-public S3 bucket and add error503.html page
  2. Create CloudFront distributed to ELB (origin path /*)
  3. In the CF create an origin with S3 point (provide S3 Origin Access)
  4. In the CF create a behavior of S3 (first priority)
  5. Set up the Error page

But nothing happened, maybe I something missing?

回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ