简体   繁体   中英

How to allow response headers in AWS API Gateway?

REST API is deployed on AWS EC2 which returns JSON response, and it is deployed on API Gateway.

This API returns a response header from AWS EC2 with status code of 200, but API Gateway is not passing it back to the client.

Do you know how to resolve this?

The response headers need to be defined and mapped explicitly depending on type of integration you have set up in the API gateway.

If you just want to relay everything back from the EC2 to the client and do not want any conversion to happen, then depending on the integration type you are using (http, vpclink) just tick the "Use Proxy Integration/Use HTTP Proxy integration" box under resource => method => integration request.

The aws doc says,

For a proxy integration, API Gateway automatically passes the backend output to the client as an HTTP response. You do not set either an integration response or a method response

For non proxy integrations, you need to setup both integration response and method response

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM