Jesse R
Jesse R

Reputation: 352

Application Load Balancer Authoriation Header not passed through

I currently have an API on API Gateway (REST) that has a single proxy endpoint hooked up to an HTTP proxy integration. I have a cognito authorizer that authorizes incoming JWTs issued by Cognito and then if valid it forwards the request along to our ECS instance via an Application Load Balancer.

The project that is running in that instance requires the Authorization header to be there for authorization purposes. The problem is that header is not forwarded to the container. After much debugging, we determined that the header was going missing when the ALB isforwarding the request to the container (previously this question was asking about API Gateway because I assumed that's where things were going wrong). Other custom headers can go through but not "Authorization".

Does anyone have any experience persisting the Authorization header using ALB? I'm very new to ALB so still learning how to build these projects.

Upvotes: 1

Views: 5301

Answers (2)

Jesse R
Jesse R

Reputation: 352

We actually had two rules on the alb. One redirecting the api call from port 80 to port 443, then a forward rule to the container. We discovered that the header went missing at the redirect rule, so we eliminated that and added listener on port 80 that forwarded the call to the ecs task.

Upvotes: 0

Skywalker
Skywalker

Reputation: 41

If you're passing a header Authorization, it will be remapped with X-Amzn-Remapped-Authorization by Amazon API Gateway REST APIs.

For more information, see this guide.

Upvotes: 0

Related Questions