Solution patterns

Learn the ins and outs of popular solution patterns, then create, customize, and deploy the solution to your Fastly configuration. Each of the following patterns is described in detail with step-by-step code walkthroughs to help you understand and learn as you go.

A/B Testing

You want to try out multiple variations of a page or a feature of your website, dividing your users into groups, some of whom experience one version, and some the other. Once a person is in one group, they should continue to get a consistent experience.

Beacon Termination

Your website includes JavaScript on the client side that generates analytics, and you want to collect this data, but want to avoid an uncacheable request reaching your servers for every page view. Fastly's real-time logging can help.

Decoding JSON Web Tokens

The popular JSON Web Token format is a useful way to maintain authentication state and synchronize it between client and server. You are using JWTs as part of your authentication process and you want to decode and validate the tokens at the edge, so that content can be cached efficiently for all authentication states.

Geofencing

Your site is available only in certain regions, or offers content that varies between regions. Whether it's at the country level or down to the square kilometer, Fastly's geolocation data offers a way to group and route traffic in a regionally specific way.

Redirects

Your servers often have to handle millions of requests for old and non-canonical URLs. This can cause unneeded load, as well as make logs messier and, if you have recently changed your site's URL scheme, you might be redirecting a lot! Learn how to shift all your static redirects to the edge using an Edge dictionary.

Serving stale

When your servers are down, or if they take a while to generate pages, end users should be able to benefit from being served cached content - even if it's slightly stale.

Waiting room

You have regular large volumes of traffic and need to limit the rate at which users can start new sessions. Once a user has been allowed in, they should retain access.