Skip to content
Advertisement

Tag: amazon-cloudfront

AWS Lambda@Edge 502 LambdaValidationError in CloudFront for redirect

I have a lambda function which performs 301 redirect if it has uri that is generated using regex. On deploying the function and adding it to the cloudfront behaviors, when I go to to the url https:my-website/xyz/faq/max, eventhough I see the status of 301 for https:my-website/xyz/faq/max after correctly re-routing to https:my-website/contact, it shows 502 Error. It shows the same error

Getting the client request domain from Lambda@Edge function

I’m trying do something like below for HTTP 301 redirect, so that web users will redirect to different news pages. However, seems like this request.origin.domainName == “mydomain.com” part is not working in my function. Is this correct way to pick the domain name which client coming from? I think this request.origin.domainName method will not work as Origin Object support only

Advertisement