Understand the HyperCache feature


HyperCache is designed to drive the proxy about objects that must be stored locally.
It basically enforce caching specific websites that use new technologies to provide objects.

Why driving the proxy ?

The proxy stores object by building a key calculated with the URL without parameters.

Examples:

  1. https://mydomain.com/myfile.zip [GOOD] will be correctly stored in cache has /cache/00/09987657 
  2. https://mydomain.com/download.php?id=98 [BAD]
    Proxy will use https://mydomain.com/download.php for the key 
  3. https://d1.mydomain.com/myfile.zip or https://d2.mydomain.com/myfile.zip [BAD]
    Proxy will store 2 elements for d1.mydomain.com and d2.mydomain.com

 

Examples 2 and 3 is now the most used on Internet:

  • Many websites use CMS Like Joomla, WordPress that stores pictures and files in a database.
  • Big websites such as facebook, google, youtube… use CDN ( Content delivery Network ) that changes the URL every time.

HyperCache is able to modify the proxy  behavior in order to help understand the example 2 and example 3.
This will increase dramatically the cache rate but require some time.

To use this feature, you have to :

  • Understand Regex language
  • Understand the target website structure ( CDN, uris, arguments )

Let us explain with a real website : www.saintjo.tv

In this website most of objects inside this website can be cached using the standard method:

https://saintjo.tv/web/data/vignettes/runball_37_480x360.jpg
https://saintjo.tv/web/data/vignettes/emd-gala_42_480x360.jpg
https://saintjo.tv/web/data/vignettes/bac-philo_46_480x360.jpg

These pictures can be stored on the cache easily.

On this website, there are some videos.

Videos are stored outside the saintjo.tv on the vod.121video.com website

Video fragments are stored on this way

https://vod.121video.com/webtv/_definst_/smil:saintjo/smil/828.smil/media_b850000_w1981548004.abst/Seg1-Frag2

Url is not correct for the proxy to stores fragments.

The first way is to create the regex pattern to detect some parts of the URL

This pattern

^https://.*.?\.121video\.com/webtv\/_definst_\/smil:(.*?)\/.*?\/.*?\/(.*?)\..*?\/(.*?)-(.*)

Will catch these values:

saintjo, media_b850000_w1981548004,Seg1,Frag2

With these values we can simplify the source URL to a new one more simple:

https://saintjo.121video.SQUIDINTERNAL/media_b850000_w1981548004Seg1Frag2

https://$1.121video.SQUIDINTERNAL/$2$3$4

Not that finishing the domain by SQUIDINTERNAL is important to pass the URL into the cache enforcement.

  • On Artica go into “Your Proxy
  • Choose HyperCache link.

2016-04-26_13-21-50

 

  • Choose rules tab

2016-04-26_13-23-32

  • Click on New rule
  • Add the modified url in the “URL returned to the proxy” and the matching regex pattern in the “pattern” field

2016-04-26_13-25-20

  • Click on Apply button to make rules in production mode.

2016-04-26_13-28-02

Leave a comment