Synthetic error response
Difficulty level: Difficult
Objective
The backend provided in this challenge returns a 503
(service unavailable) error response that includes a unique error code in an HTTP response header called error-code
. Your goal is to serve a pleasant-looking synthetic HTML response from the edge, but include the error code from the original 503
response in the body of the synthetic response.
This requires proper handling of the original non-cacheable 503 response, but it also requires pulling out the value of the error-code
header, and including it into the synthetic response being delivered back to clients.
The challenge includes two identical requests. The second should produce the same outcome but not require the fetch to the backend.