Anna MacLachlan, Content Marketing Manager

Ecommerce companies face challenges that a content delivery network built on Varnish can help address. To stay competitive and relevant, ecommerce websites and applications need to be able to target specific content to specific users (based on location, language, or browsing preferences), tailor content delivery depending on which device a consumer is using, and prioritize shoppers based on actions they’ve taken within a site or app. Varnish can help accomplish all of this.

Varnish is infinitely configurable with Varnish Configuration Language (VCL), so your business can cache more content at the edge (by “edge” we mean a CDN’s points of presence that are geographically closest to your users). Logic used to have to be on an origin server, but Fastly allows you to put as much logic as possible closer at the edge. (For websites, logic is the part of the programming that defines how data is created, changed, displayed, and stored.) This in turn helps you serve content to your users even more quickly.

Our CDN is set up to let you use a number of edge modules, which are specific types of logic designed to address common needs. Below, I’ll outline some of the common modules that benefit ecommerce sites.

Edge Authorization / Paywalls

With Edge Authorization, you can move authorization out to the edge, instead of making authentication pass through the origin server each time (which would lead to slower performance and content delivery).

Online authorization is a system set up to verify that the user attempting to access the content is authorized to access that content, either by paying a fee or signing up for a service. For example, with streaming media applications, only subscribers are allowed access to the media, i.e., the protected content. Using a CDN, an application that allows users to pay for streaming media will cache its media assets at the edge of the network, so users can access the content more quickly.

The authentication request verifying that a user has permission to access a particular piece of content normally has to go through the origin server each time, which takes away many of the speed and performance gains from caching media on the CDN. But with Varnish and VCL, it’s possible to implement authorization logic at the edge. The authentication only has to go through the origin server one time, and then subsequent authentication requests can be handled by the CDN. Read more about enabling token authentication.

Ultimately, this means that you don’t have to build up a massive server infrastructure of your own — you can rely on Fastly for scalability.

GeoIP / Geography Detection

With VCL, you can identify where your user requests are coming from by a number of geographic variables, including latitude, longitude, city, town, country, continent, postal code, telephone area code, and metro code. You can also use GeoIP to create a virtual boundary set to your specifications (geo-fencing) and send users inside that boundary localized content and logic. With GeoIP, you can serve users localized content like coupons by city or zipcode, serve different languages as needed, and show product availability by region — and you can do all of this while keeping your content cached at the edge.

GeoIP can also help companies with multiple origin servers direct traffic and optimize site performance. If you have origin servers in both the US and the UK, you can cache logic that directs US user requests to the origin to the US origin server, and UK traffic to the UK origin server. Geography Detection also allows you to perform geoblocking during targeted attacks. You can detect where the attacks are coming from, and block all traffic originating from that location.

Mobile Device Detection

The ability to detect mobile devices and customize content in real time will allow you to create the best possible experience for your users. This is important because 74% of users won’t return to a mobile site that takes longer than five seconds to load, and 47% of mobile ecommerce buyers don’t complete a purchase on a mobile device because the checkout process takes too long. Additionally, mobile ecommerce is projected to grow to $3.2 trillion by 2017.

By enabling Mobile Device Detection, you can serve content based on the specific device users are accessing the site with. For instance, if a user is viewing your site on an iPhone, you’ll want to serve them images with smaller dimensions, to fit the screen, but with higher quality, to take advantage of the iPhone’s retina quality display. When serving content to a user viewing your site with a different smartphone, you can send them lower resolution images that don’t take up as much bandwidth.

Visitor Prioritization

When an ecommerce site starts to get overloaded, you can use visitor prioritization logic to determine who is just browsing your site, and who is actively trying to buy something. With this logic, you can redirect casual shoppers to a waiting room, while active buyers can access the site freely and complete their transactions. Otherwise, during times of high traffic such as Black Friday and the holiday shopping season, you run the risk of both users getting a server too busy error. And with 79% percent of users choosing not to buy from ecommerce websites that perform poorly, that’s potentially a lot of money lost from otherwise paying customers.

ESI (Edge Side Include)

Previously, when your site had a page with a mixture of cacheable and uncacheable content on it, you couldn’t cache the entire page. With ESI, you can mix both types of content on the page, have your CDN serve cacheable content, and only send requests back to the origin for the uncacheable content on the page. With an ecommerce site, this means you can cache other content on a page with an uncacheable shopping cart.

In addition to these edge modules, here are some other situations Varnish can help with — check out our blog post about the benefits of using Varnish.

Please contact sales-ecommerce@fastly.com to discuss our ecommerce solutions and PCI-enabled ecommerce packages.