synthetic.base64 statement replaces the content of the cache object's response body with the specified string, when processing an error state. The argument is treated as base64-encoded and decoded, the resulting bytes are passed into the output buffer. Since the decoded data never exists as a
STRING type, this statement is safe to use with non-textual data, such as images.
Typically, synthetic responses are used to create customized error messages or responses to API calls, but can be used to serve full pages of content, favicons or small images.
Try it out
synthetic.base64 is used in the following solution recipes. Recipes apply VCL to real-world use cases and can be deployed as-is, or adapted for your own service. See the full list of recipesfor more inspiration.
Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.
Synthetic binary responses
Serve binary objects, such as images, directly from edge configuration by encoding them using Base64 encoding.
User contributed notes
We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.