0

We have a simple architecture as shown in the photo below, where clients sends a request to the API Gateway. API Gateway invokes a custom Auhtorizer which then responds with IAM Policy and Context. The request is then forwarded to the ECS service if allowed.

enter image description here

Our API Gateway integration request type is configured as VPC Link (VPC_PROXY).

enter image description here

We would like to attach the Auhorizers Context to the API Gateway request that is then passed to the ECS Service.

The returned context from the Authorizer looks like this:

"context": {
"users": "[\"21661\"]"
}

We tried mapping the context to the HTTP Headers as suggested by many sources, but it didn't work.

enter image description here

Is it possible to pass the context to ECS service in any other way?

Rok T.
  • 380
  • 5
  • 11
  • Your question looks like a duplicate of this one: https://stackoverflow.com/questions/45631758/how-to-pass-api-gateway-authorizer-context-to-a-http-integration Does the answer there work for you? – Mark B May 10 '23 at 16:57
  • Thanks! The answer from Magnus Engdal: https://stackoverflow.com/a/45692805/8070550 contained the missing piece - we needed to add the header to Method Request as well. Which is odd as there are others there commenting that its not needed (so the same configuration that we already had as I described in the question)... I suspect its something with the VPC_PROXY/VPC Link integration type and/or the checked "Use Proxy Integration" toggle. – Rok T. May 11 '23 at 19:22

0 Answers0