We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 718db13 commit bc4d5eeCopy full SHA for bc4d5ee
redirect-based-on-country/index.js
@@ -2,11 +2,11 @@ async function handler(event) {
2
var request = event.request;
3
var headers = request.headers;
4
var host = request.headers.host.value;
5
- var country = Symbol.for('DE'); // Choose a country code
+ var country = 'DE' // Choose a country code
6
var newurl = `https://${host}/de/index.html`; // Change the redirect URL to your choice
7
8
if (headers['cloudfront-viewer-country']) {
9
- var countryCode = Symbol.for(headers['cloudfront-viewer-country'].value);
+ var countryCode = headers['cloudfront-viewer-country'].value;
10
if (countryCode === country) {
11
var response = {
12
statusCode: 302,
0 commit comments