Amazon CloudFront Announces Wildcard Cookies and Options Caching

Posted on: Oct 7, 2014

You can configure CloudFront to forward cookies to your origin and cache your objects based on cookie values in viewer requests. Previously, you could specify a whitelist of cookie names, but you had to specify exact names. Starting today, you can use wildcard characters in the whitelisted cookie names that you want Amazon CloudFront to forward to your origin server. This feature makes it easy to set multiple cookies to forward to the origin server at the same time. For example, several applications, including Drupal and WordPress, alter cookie names with a hash to identify logged in users, so SESS (for session-ID) becomes SESS<MD5 hash>. In this example, you can now whitelist *wordpress*, or *SESS* values as valid cookie names, and CloudFront will forward any cookie containing “wordpress” or “SESS”.

We have also enabled the ability to specify whether you want CloudFront to cache the response from your origin server when a viewer submits an OPTIONS request. An OPTIONS request allows you to retrieve a list of the options that your origin server supports. Amazon CloudFront caches the response from GET and HEAD requests by default. By also configuring CloudFront to cache the responses for OPTIONS requests, you can further decrease latency for your end users because CloudFront will respond to the OPTIONS requests from the cache instead of repeatedly forwarding the requests to your origin server.

There are no additional fees for using these new features with CloudFront. Getting started is easy – just use the AWS Management Console or APIs to use wildcard characters in cookie names or enable OPTIONS caching. To learn more about Amazon CloudFront you can visit the Amazon CloudFront product page.