Created
July 6, 2018 03:49
-
-
Save twoBoots/ead4e97229b7008e4ffefadb263f549b to your computer and use it in GitHub Desktop.
API Gateway HTTP basic auth using Lambda@Edge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.handler = (event, context, done) => { | |
| const response = event.Records[0].cf.response; | |
| const headers = response.headers; | |
| if(headers['edge-www-authenticate']) { | |
| headers['www-authenticate'] = [{key: 'WWW-Authenticate', value: 'Basic realm="Secure Area"'}]; | |
| delete headers['edge-www-authenticate']; | |
| } | |
| done(null, response); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment