Enrich requests with geolocation

Difficulty level: Beginner

Objective

This challenge requires you to add headers to requests as they flow through Fastly, on the way to the backend. In this scenario, the backend server is configured to return different responses depending on the country in which the end user is located.

Add code that appends a client-geo-country header to the request and sets the value to the two-character ISO country code of the end user's location.

Try this challenge now

For a guide to how challenges work see getting started.

User contributed notes

BETA

Do you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact support@fastly.com)