Skip to content

Instantly share code, notes, and snippets.

@section-io-gists
Last active October 9, 2017 15:35
Show Gist options
  • Save section-io-gists/57e67547b170f0a3be7c91d8a2e891d4 to your computer and use it in GitHub Desktop.
Save section-io-gists/57e67547b170f0a3be7c91d8a2e891d4 to your computer and use it in GitHub Desktop.
Language header based on country code.
sub vcl_recv {
# Set a X-Language header to spanish is the client is from a spanish speaking country
if (req.http.section-io-geo-country ~ "^(AR|BO|CL|CO|CR|CU|DO|EC|SV|GQ|GT|HN|MX|NI|PA|PY|PE|ES|UY|VE)$") {
set req.http.X-Language = "Spanish";
} else {
set req.http.X-Language = "English";
}
}
sub vcl_hash {
hash_data(req.http.X-Language);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment