August 27, 2020
4 min read time

Varnish Enterprise adds Digital Element IP intelligence for localizing content at the edge

varnish_digital_elements

 

Content providers often cater to global audiences when delivering streaming, news, e-commerce and gaming services. This makes tailoring content to specific locations crucial for delivering the best web experiences for their users. Being able to feed IP intelligence into content delivery operations means you can offer personalized, location-specific content experiences while managing global web traffic levels intelligently. Granular, location-based control over content delivery enables content localization, enhanced analytics and the ability to manage access and digital rights in line with national regulations and traffic patterns.

 

Varnish Software has partnered with Digital Element to deliver IP intelligence that’s integrated into caching technology, for enabling ultra high speed delivery of personalized, location-based web content.

Varnish Enterprise powers content delivery and streaming for some of the world’s largest streaming services and websites, such as Hulu, Twitch, CBC and Sky. Its pioneering caching technology puts content closer to users while protecting critical infrastructure from the effects of huge demand. As the leading caching technology stack for enterprises, Varnish Enterprise brings unparalleled performance, resilience and flexibility to content delivery operations such as live streaming, video on demand and dynamic web pages. Integrating the industry’s most accurate geolocation data provides an easy-to-use and always up-to-date service that you can query to retrieve location information linked to an IP address.

 

Adding Digital Element IP intelligence to Varnish Enterprise

Integrating IP intelligence from Digital Element is simple with Varnish Configuration Language, or VCL. This is Varnish’s domain-specific language that enables complete customization and allows you to define policies with programmable edge logic that executes in real time. It expands Varnish Enterprise capabilities to enable edge computing, web application firewalls, load balancing, DDoS prevention and HTTP routing. Here, it allows you to integrate IP intelligence easily into your Varnish process


The API is dead simple, with a single endpoint returning a straightforward JSON object:

{"response": {
"pulse-region-full-name" : "california", str;
"pulse-metro-name" : "los angeles",
"pulse-country" : "usa",
"pulse-city" : "santa monica",
"pulse-postal-code" : "90401",
"pulse-continent-code" : "6",
"pulse-gmt-offset" : "-700",
"pulse-timezone-name" : "america/los_angeles",
"pulse-latitude" : "34.03",
"pulse-region" : "ca",
...

 

This makes Varnish integration a breeze:

1. Include the provided DE.vcl file.
2. In the vcl_init function, set your Digital Element-provided user token

Include “DE.vcl”;
sub vcl_init {
de_state.set("token", "your_DE_user_token");

}

 

You can now access the wealth of IP-based geolocation information that Digital Element provides through its NetAcuity Web Service, directly from your Varnish VCL. Just access the JSON object and make decisions based on the data. There are many things you can do with this.

 

Geo-fencing

To only accept requests from a certain country use this test in the vcl_recv function:

if (json.get("response.pulse-two-letter-country") !="us") {
return(synth(403, "Only available in the US."));
}

 

Rate limiting

If you want to be less restrictive, but still favor your main user base, or allow continental traffic, but rate-limit it:

 if (json.get("pulse-continent-code") != 6)
return(synth(403, "Only available on the american continent"));
} else if (json.get("response.pulse-two-letter-country") != "us" &&
vsthrottle.is_denied(“limited”, 150, 1s))) {
return(synth(420, "You got throttled"));
}

 

For another example showing how easy it is to use Digital Element data from within your VCL, here is a code snippet which adds a cityname response header:

 


sub vcl_synth {
if (resp.status == 200) { 
set resp.http.cityname = json.get("response.pulse-localized-city-names");
}
}

 

Localized content with edge-side decision making

Integrating Digital Element’s IP intelligence with Varnish Enterprise is a convenient way to discover more about your online users in order to provide them with location-specific content in line with local regulations and content delivery strategy. It’s easy to set up, unlocks a whole host of new use cases for localizing content experiences and managing traffic levels, all while staying accurate and up to date. Using Varnish Enterprise to do content delivery decision making at the edge means it’s ultra high speed, cacheable, efficient, and optimized for every user.

 

reach_people_faster