--- swagger: "2.0" basePath: "/test" schemes: - "https" paths: /lambdaredirect-default: get: produces: - "application/json" parameters: [] responses: 200: description: "200 response" schema: $ref: "#/definitions/Empty" headers: {} 302: description: "302 response" headers: Location: type: "string" x-amazon-apigateway-integration: responses: default: statusCode: "302" responseParameters: method.response.header.Location: "integration.response.body.location" uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:[ACCOUNT_ID]:function:redirect-default/invocations" httpMethod: "POST" type: "aws" /lambdaredirect-error: get: produces: - "application/json" parameters: [] responses: 200: description: "200 response" schema: $ref: "#/definitions/Empty" headers: {} 302: description: "302 response" headers: Location: type: "string" x-amazon-apigateway-integration: responses: default: statusCode: "200" https://.*: statusCode: "302" responseParameters: method.response.header.Location: "integration.response.body.errorMessage" responseTemplates: application/json: "## intentionally blank" uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:[ACCOUNT_ID]]:function:redirect-error/invocations" httpMethod: "POST" type: "aws" securityDefinitions: sigv4: type: "apiKey" name: "Authorization" in: "header" x-amazon-apigateway-authtype: "awsSigv4" definitions: Empty: type: "object" -- Lambda Function "redirect-default": -- exports.handler = function(event, context) { context.succeed({ location : "https://example.com" }); }; -- Lambda Function "redirect-error": -- exports.handler = function(event, context) { context.fail("https://example.com"); };