pass headers from clients via method request to integration request with body intact for REST API in AWS API Gateway

0

I have a REST based API in AWS APIGateway and I would like to pass some headers that clients send from method request to integration request.

Details about my integration request: In Integration Request of my POST method, "Integration type" is 'AWS Service', "AWS Service" is set to 'Sagemaker Runtime' and "Content Handling", to 'Passthrough'.

Only Content-Type header is being passed to the integration request. I would like 3 more headers that client sends to be sent to the integration request, as headers, not modifying the body. I need this because, that's how the SageMaker endpoint(AWS Service in my integration request) expects clients to send requests.

I have tried mapping templates and I have been able to access all the headers and send them to integration request, but all the headers are being included in the request's body. I don't want this.

How do I pass 3 of any number of headers clients send to the API to integration reuqest? I am fine if all headers get sent, but I want 3 headers to be passed.

1개 답변
1
수락된 답변

In the console, in the Integration Request page there is a Headers section. Just select the 3 headers that you want to send to the integration and map them to method.request.header.xyz

profile pictureAWS
전문가
Uri
답변함 2년 전
profile picture
전문가
검토됨 14일 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인