Distinguish origin from Fastly errors

Difficulty level: Beginner

Objective

This challenge includes two requests. One will yield a 503 (service unavailable) response from the origin, and another will return a synthetic 503 generated by Fastly, because the origin request times out.

Write VCL that will add a header to all error responses (status code >= 400), identifying whether the 503 response was generated by Fastly or generated by the origin. The response header names must be x-origin-error (for an error served by the origin) and x-fastly-error (for the error generated by Fastly). It doesn't matter what the values of the headers are, but "1" would be fine.

Try this challenge now

For a guide to how challenges work see getting started.