Posted On: Feb 28, 2022

Amazon AppSync is a managed serverless GraphQL API service that simplifies application development by letting you create a flexible API to securely access, manipulate, and combine data from one or more data sources with less network calls.

Until today, AppSync could only return an API response payload without additional configurable HTTP headers. Amazon AppSync now supports configuring custom HTTP headers in responses to GraphQL operations. With the new feature it’s possible to define directly in AppSync additional headers sent to clients upon a response to an API call. For instance, if there’s a security requirement for a specific header to be present in the HTTP response the GraphQL operation can be configured in AppSync to generate the header.

Amazon AppSync provides a set of built-in utility helpers which can be leveraged within a GraphQL resolver to simplify interactions with data sources or clients. You can get started with the new feature by configuring the response for a GraphQL API operation with a new resolver utility $util.http.addResponseHeaders().

This feature is available in Amazon Web Services China (Beijing) Region, operated by Sinnet and Amazon Web Services China (Ningxia) Region, operated by NWCD. For more details on the new VTL utility helper to customize HTTP response headers, refer to the Resolver Mapping Template Utility Reference AppSync documentation.