Adding a custom Header for Options

aws

#1

We’re using the lambda proxy approach and we’re unable to deploy with a custom header for the options methods. I’ve tried to set the custom header (X-CUSTOM-Auth) on the serverless.yml, e.g.:
cors: true
headers:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-CUSTOM-Auth

The above doesnt deploy the X-CUSTOM-Auth header to the options method integration response. I have to go manually add it, not ideal and not scaleable with a build process. Anyone else have a way this works??


#2

disregard, it was my bad - i was using trying to use the cors: true and set headers… looks like you need to do either or. and use the correct indentation! :-/ hard to tell above since it gets stripped in this editor


#3

not related to cors, but for your indenting issue, add 3 backticks(next to 1 under the ~) above and below your yml snippet and ti will preserve any tabs/spaces/etc…

example:
  - yippy 
  - I'm helping

Hope it helps.