0.2.2 • Published 8 years ago
api-gateway-proxy-lambda v0.2.2
API Gateway Proxy Lambda
Purpose: lambda to proxy incoming calls to defined host
How to use
- Create lambda
index.js Setup API Gateway resource with
ANYmethod- Enable proxy mode
Configuration
All configuration done by env properties
TARGET_DOMAIN: string, required- target proxy host (exclude protocol)TARGET_PORT: number, optional, default 80 for http and 443 for https- target proxy portCORS: boolean, optional, default false- automatically add CORS header to all responsesCORS_AUTO_OPTIONS: boolean, optional, default false- replay on all OPTIONS request correct CORS for all*EXCLUDE_PATH_PREFIX: string, optional, default empty- very useful for API Gateway, this string will be exclude from start of path. For example you send request to http://x/Stage1/start and want to proxy as http://target/start, just configure that property/StagePATH_PREFIX: string, optional, default empty- prefix to add in proxy path
Configuration example:
Lambda
Type: AWS::Lambda::Function
Properties:
Environment:
Variables:
TARGET_DOMAIN: test.com
TARGET_PORT: 8080
CORS: true
CORS_AUTO_OPTIONS: false
PATH_PREFIX: abb
EXCLUDE_PATH_PREFIX: /Stage1Releases
0.2.2
- update docs
0.2.1
- support CORS auto OPTIONS response when
process.env.CORS_AUTO_OPTIONS = true - fix
event.pathtoevent.resourcePath - add coverage report
0.2.0
- support
process.env.EXCLUDE_PATH_PREFIX: Stringif defined and path starts from it will be removed before proxy. For example path before proxy/Beta/testand exclude/Betaproxied path will be/test - fix
httpMethodpassing - log incoming
eventandproxy requestwhenprocess.env.DEBUGenabled - support
process.env.HTTPS: Booleanto use HTTPS for proxy request - support
process.env.CORS: Booleanto add CORS headers
0.1.0
- support
process.env.PATH_PREFIX
0.0.1
initial release