Add a custom request header on an Integration Request

Hi all! I need to add a custom request header on a proxy resource. When I GET to /authentication/login, I need to be redirected to https://url.to.login with a custom request header.

This is my yml file:

Login:
  handler: login
  events:
    - http:
        path: /authentication/login
        method: get
        integration: http-proxy
        request:
          uri: https://url.to.login
          method: get

I can do that from the AWS console editing the Integration Request and it works:

  1. Click on Integration Request

  2. On the Edit form, I can add the Request Header

How can I do this from Serverless? Thanks

1 Like

@diego1686 did you ever find a solution to this?

Thanks.

@iamroberthanson
If you want to inject a header into a proxied request you can do this:

 Login:
  handler: login
  events:
    - http:
        path: /authentication/login
        method: get
        integration: http-proxy
        request:
          uri: https://url.to.login
          parameters:
            headers:
              HEADER_NAME: "INSERT HEADER VALUE HERE"