I’m using an API Gateway endpoint as a proxy to a 3rd party service.
Given I authenticate to the proxy endpoint using the value in the Authorization header
When the proxy makes the request to the 3rd party
Then it should be using the 3rd party api-key (pulled from SSM) as the value in the forwarded Authorization header
But the request to the 3rd party is using the original request Authorization header value
The function definition in my serverless.yml:
functions:
3rd_party_proxy_v1:
handler: handler.hello
events:
- http:
path: /v1/{proxy+}
method: ANY
integration: HTTP_PROXY
authorizer: ${self:custom.authorizer_arn}
cors: true
request:
uri: ${self:custom.3rd_party_base_url}/api/v1/{proxy}
parameters:
paths:
proxy: true
querystrings:
data: true
headers:
Authorization: "'SSWS ${ssm:3RD_PARTY_API_KEY~true}'"
When I test this functionality via the console it works as expected, using the value pulled from SSM.
However, when I test it by hitting the api gateway directly it just passes through the auth header value.
The only way I can get it to work is by manually setting the header value via the console but I’d like to have this happen programmatically, can serverless support this?