Created
January 12, 2021 04:11
-
-
Save ezr/c1ba700f74ae81bfb113b3a9fe180ba7 to your computer and use it in GitHub Desktop.
AWS lambda function to return an HTTP redirect (golang)
This file contains 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
package main | |
import ( | |
"github.com/aws/aws-lambda-go/events" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
type Response events.APIGatewayProxyResponse | |
func Handler() (Response, error) { | |
resp := Response{ | |
StatusCode: 307, | |
Headers: map[string]string{ | |
"Location": "https://gist.github.com", | |
}, | |
} | |
return resp, nil | |
} | |
func main() { | |
lambda.Start(Handler) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment