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.
HINT: To learn about using
synthetic.base64 to deliver custom responses at the edge, see the
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.
synthetic.base64 is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.
Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.
Serve small binary assets direct from edge
Serve binary objects, such as images, directly from edge configuration.