This resource allows you to load common Javascript and CSS libraries from a single source. It exists because we were experiencing significant downtime with the common public CDN providers. While none of them were experiencing huge downtime, it never overlapped with our own and therefore caused problems.
The idea here is to maximize the convenience of the public CDN providers, so this resource is essentially a caching proxy of those providers.
Performance Note: This CDN is almost guaranteed to have worse uptime than the source CDNs. It also is pretty much guaranteed that visitor's won't have the files cached on first visit. It only makes sense to use it if you are also using one of the other assets on this server.
To use, rewrite the URL of the CDN provided asset to replace the domain name with this CDN. For example:
http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css
should become:
//assets.euractiv.com/cdn/bootstrap/3.3.5/css/bootstrap.css
The supported libraries are:
In most cases, it is better to reference minified resources directly if the
source offers them. If not, you can prepend the requested file with
min/
to have this CDN do the minifcation for you. The code
from the quick start example would change:
//assets.euractiv.com/cdn/bootstrap/3.3.5/css/bootstrap.css
to:
//assets.euractiv.com/cdn/min/bootstrap/3.3.5/css/bootstrap.css
Configuration is located in the file /config/cdn.php
.
If you do not have the ability to modify this file, contact your
administrator to have options changed. The configuration file should
contain an array with the name $config
containing the
following offsets:
Name | Type | Description | Current Setting |
---|---|---|---|
example_file | string | A file to use for the "Quick Start" example | bootstrap/3.3.5/css/bootstrap.css |
domain_map | array | The maps of files to the source CDN domain. The format is an array
of arrays, where each item has the following entries:
| Login to view this setting |
callmap_driver | string | The callmap driver to use, either "sqlite", "fsstore" or "noop" | noop |
callmap_labels | array | Labels for the callmap, where the key is the regular expression to match and the value is the label to use | Login to view this setting |
callmap_visualize_default | array | Nodes to visualize by default | Login to view this setting |
callmap_probability | integer | Probability that a given hit will log. Important for high traffic sites. Set higher for lower probability. | 1000 |
http_allowed_domains | array | Allowed domains for fetching assets or generating URLs | Login to view this setting |
http_allowed_urls | array | Specified URLs or regular expressions of specified URLs match for fetching assets or generating URLs | Login to view this setting |
http_connect_timeout | integer | The amount of time, in seconds, that cURL should wait before returning an error status. 15 is a good value for most cases. | 15 |
api_key | string | The key to access protected API calls. This key should only be used in server-to-server communication to avoid exposing it to the broader internet. In requests, the key can be set in the query as the "api_key" value (eg http://example.com?api_key=keyboard_cat), in a POST request body as the "api_key" value, or as a header with the name "X-Vsac-Api-Key". | Login to view this setting |