Skip to content

Capture users country of origin and redirect their requests to the s3 bucket closets to them

License

Notifications You must be signed in to change notification settings

bahaipedia/lambda-edge-detect-origin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

lambda-edge-detect-origin

Capture users country of origin and redirect their requests to the s3 bucket closest to them

In our setup Cloudfront sits in front of user media requests. We host a number of large files which are not requested frequently, consequently our miss rate can be high and Cloudfront must request the file from the origin s3 bucket. For users who are geographically far from the origin bucket download times can be noticably slow. Our Cloudfront distributon has 5 origins. This function analyizes a users country of origin in order to signal which origin bucket Cloudfront should use in the case of a cache miss.

See also, repository lambda-edge-file-redirect which captures edge cases and returns an otherwise 'missing' file.

About

Capture users country of origin and redirect their requests to the s3 bucket closets to them

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages