aws-samples / aws-samples/amazon-cloudfront-functions

Redirect naked to www example

Open
#5 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
533
Forks
76
PR merge metrics
No merged PRs in 30d

Description

It would be helpful for me to have an example of how to redirect naked to www (e.g. requests to domain.com should 301 to www.domain.com). When migrating from lambda@edge to cloudfront functions, some things seemed to change, like the structure of the "event" parameter, and it was a little confusing to me at first.

I'm also not sure if best practice is that it's more efficient/cheaper to use lambda@edge Origin Request for this type of an operation (because it can then be cached for a long time on subsequent requests), or cloudfront function Viewer Request.

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.