Serve a custom error page from S3 through CloudFront while the ALB fault is fixed
Short answer
AE Host the custom error pages in S3 and add a CloudFront custom error response to return them.
Question
Key Takeaways
CloudFront can be configured with a custom error response that maps the 502 status to an object in an S3 bucket, so the visitor gets the branded page while the transient origin fault is being resolved, and neither Route 53 nor the ALB needs to be reconfigured.
An ecommerce application behind an ALB occasionally returns a 502 Bad Gateway because the targets return malformed HTTP headers, and reloading immediately afterwards succeeds. While engineers investigate, visitors should see a custom error page instead of the default ALB error page.
Common mistake: Rewiring DNS or the ALB forwarding rule to a fallback web server. Those approaches change the request path for all traffic, add a component to operate, and the fault here is transient and application-level, so pointing production traffic at a different origin is a much larger change than adding an error response.
Expert Analysis
Why the Answer Is Correct
The problem is a transient 502 returned by the ALB, and the immediate need is only what the visitor sees during that window. Hosting a static custom error page in an Amazon S3 bucket is the cheapest way to have that page available, and it requires no change to the existing application or ALB configuration. A CloudFront custom error response is then configured to return that S3 object when CloudFront receives the 502 status, so visitors see the branded page. Because the fault is transient and the page reload succeeds, this is a presentation-layer measure that carries the least operational overhead, since no new compute, DNS, or health check logic has to be maintained.
Why the Other Options Are Wrong
B: Modifying the ALB forwarding rule to point at a publicly accessible web server is a response to a health check failure metric, but the root cause here is malformed headers on specific requests rather than failing health checks, and changing the forwarding rule would redirect normal production traffic to a fallback server. D: Using the Elb.InternalError metric has the same two problems as B, since it changes the request path for all traffic and requires Lambda plus a fallback web server to operate. C: Adding health checks and a fallback target in Route 53 is aimed at resolving records when a target is unhealthy, which is not the failure described, and it adds DNS-level complexity for a page-rendering requirement.
Community Comment Notes
The community voted 100 to 0 for A and E, and the top-voted comment linked the CloudFront documentation for generating custom error responses. A commenter also noted this is the same question as an earlier item in the same practice set, which is consistent with the fully unanimous answer.
Official Reference
This link opens the official vendor documentation in a new tab.
Community Votes
100% of anonymous learners picked answer AE. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 8 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 8
-
pangchn 👍 5same question as page1 question 10
-
kejam 👍 3Answer: AE All other answers won't help for transient failures https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/GeneratingCustomErrorResponses.html#custom-error-pages-procedure
-
AzureDP900 👍 1Option A allows for a simple and quick solution by hosting a custom error page on Amazon S3. No changes are required to Route 53, CloudFront, or the ALB. Option E uses CloudFront to display a custom error page without modifying any other resources. Both options A and E meet the requirement with minimal operational overhead, so choosing both of them is correct!
-
alexis123456 👍 3correct answer is A and E
-
arberod 👍 2it is AE
Show 3 more comments
-
master9 👍 1answer is A and E
-
duriselvan 👍 1A,B, ans
-
career360guru 👍 1A and E
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All SAP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full SAP-C02 Practice Test →