Member-only story

Localizing content with Lambda@Edge

Gavin Lewis
5 min readMar 18, 2019

Recently our marketing team came to me with the challenge of localizing content for viewers from different countries on the GreenOrbit website. They explained the use case and benefits to running a multi-regional and multi-lingual website, it was all well planned out and just needed to be executed. To provide some background, the GreenOrbit website is built using a serverless architecture and powered by gatsby.

The team had already found a plugin to use with Gatsby to help build the content but they needed a “server side” method to perform a redirect to the localized content depending on what the user’s browser language was set to. All other resources such as images, css and javascript are shared. As an example of how the end solution needs to work, when a user from Australia visits the website the expected behaviour is a redirect 302 to /en-au/ to occur.

An example of the redirect occurring

While I’ve been experimenting with Lambda@Edge in my own time recently, I’d never used it in a production ready website or app. The concept is very simple however, capture a request or response between your visitor and CloudFront or between CloudFront and your origin (where your content comes from, s3 in our case), execute some code and…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Gavin Lewis
Gavin Lewis

Written by Gavin Lewis

Passionate about building and delivering solutions in the Cloud! Principal Cloud Architect @ Rapid Circle. Views are my own.

No responses yet

Write a response