Important note

This tutorial assumes you have already created a pull zone.

Scenarios vary from case to to case when/where cookies can be used on your website and the essential product is cookie-set on origin files used for either authentication, session id, etc. Cookies are, by nature, un-cacheable and therefore files containing these portions of codes are also un-cacheable which adds bad performance experience when loading CDN assets containing cookie-set.

As all other un-cacheable files, CDN will only work as a simple proxy when end user requests cookie-file from CDN – each time CDN will proxy this request to origin and deliver file via reverse path:

Browser (end user) —> CDN —> Origin —> CDN —> Browser (end user).  This scenario will pile up the load time which is not performance experience you want. Http header containing cookie-set: You can verify CDN is not caching this file (or these files) by running a “curl” command like:

Solution for this gap would be to simply ignore cookies in requests and force CDN to cache that file(s). We have implemented useful option you can reach through the control panel and thick the box next to it — Strip All Cookies — :

strip-cookies

 Re-run previous command and you should be able to verify that file is now successfully cached (X-Cache: HIT):
NOTE:  If you use Cloud Flare you will follow same settings as CF adds cookie-set to origin files preventing CDN from caching those files, or refer to this page:  /support/howto/use-cdn-with-cloudflare/