Overview
Inserting Expansion Variables into the settings of certain configuration policies is an advanced method for fine tuning the delivery of your content over the Highwinds CDN Network.
Expansion Variables are an advanced feature you can take advantage of whether you're interacting programmatically with the APIs or via StrikeTracker.
A complete list of the expansion variables currently available for use on the Highwinds CDN is listed below.
Expansion Variables
General Expansion Variables | |
%server.ip% | The Server IP |
%server.fqdn% | The Server Host Name |
%server.name% | The Server Name |
%server.pop% | The Server Pop |
%server.region% | The Server Region |
%server.platform% | The Server Platform Name |
%server.epoch% | The Server Time |
%client.ip% | The Client IP |
%client.request.protocol% | The protocol of the request (http/https) |
%client.request.host% | hostname in the Host header of the request |
%client.request.fullurl% | Full URL of request (including protocol and host name) |
%client.request.fullfilepath% | Full File Path from request (without qs param) |
%client.request.params% | Query Parameters from request (with leading ?) |
%client.request.pathonly% | Only Path (without filename) from request |
%client.request.filename% | Only filename from request |
%client.geoip.areaCode% | The telephone area code |
%client.geoip.city% | The city or town name |
%client.geoip.continentCode% | The two-character code for the continent |
%client.geoip.countryCode% | The two-character ISO-3166-1 country code |
%client.geoip.countryCode3% | The three-character country code |
%client.geoip.countryName% | The country name |
%client.geoip.dmaCode% | Designated Market Area code |
%client.geoip.latitude% | The latitude |
%client.geoip.longitude% | The longitude |
%client.geoip.postalCode% | The postal code |
%client.geoip.regionCode% | A two character ISO-3166-2 or FIPS 1-=4 code for state/region |
%client.geoip.regionName% | The region name |
%client.geoip.timeZone% | The time zone is generated from IANA time zone database (e.g., America/New_York) |
%query.separator% | The query separator character |
%function.random(min, max)% | Random Number Generator |
Request Receipt Expansion Variables | |
%delivery.firstByteDuration% | Time duration of first byte |
%delivery.contentTransferDuration% | Duration in milliseconds of the download. Ex: 57 |
%delivery.bytesFromCache% | The Bytes from the cache for the delivery |
%delivery.contentBytesServed% | Total Content Bytes served |
%delivery.sendResult% | success | abort, where success means the CDN successfully delivered a response to the client, regardless of the HTTP status code. |
%delivery.totalBytesServed% | Total bytes downloaded to the client. Ex: 5140 |
%delivery.cacheHit% | Whether or not there was a cache hit |
%delivery.firstByteServed% | The Time for the first byte served |
%delivery.lastByteServed% | The Time for the last byte served |
%delivery.attemptedBytesServed% | Number of bytes that the CDN attempted to download. Ex: 5140 |
%delivery.filesize% | On-disk size of the requested asset. Ex: 125554 |
%client.request.params% | Query Parameters from request (with leading ?) |
%client.request.headers.range.value% | Value of the Range header in the client request if it exists. Ex: bytes=5000-9999 |
%client.request.host% | The hostname in the Host header of the request |
%client.request.filename% | Only filename from request |
%client.request.endTime% | Unix timestamp marking the end of the request. Ex: 1392413133 |
%client.request.method% | The client request method |
%client.request.fullUrl% | Full URL of request (including protocol and host name) |
%client.request.protocol% | The protocol of the request (http/https) |
%client.request.pathOnly% | Only Path (without filename) from request |
%client.request.fullFilePath% | Full File Path from request (without qs param) |
%client.request.http.version% | The HTTP Version for the client request |
%client.request.startTime% | Unix timestamp marking the beginning of the request. Ex: 1392413033 |
%client.geoip.countryCode3 | The three-character country code |
%client.geoip.timeZone% | The time zone taken from IANA time zone database (eg America/New_York) |
%client.geoip.regionName% | The region name |
%client.geoip.city% | The city or town name |
%client.geoip.countryCode% | The two-character ISO-3166-1 country code |
%client.geoip.areaCode% | The telephone area code |
%client.geoip.postalCode% | The postal code |
%client.geoip.regionCode% | A two character ISO-3166-2 or FIPS 1-=4 code for state/region |
%client.geoip.dmaCode% | The Designated Market Area code |
%client.geoip.continentCode% | The two-character code for the continent |
%client.geoip.countryName% | The country name |
%client.geoip.latitude% | The latitude |
%client.geoip.longitude% | The longitude |
%client.ip% | IP in dot-notation of the client. Ex: 10.10.5.104 |
%client.response.headers% | The response headers from the client |
%origin.request.params% | The parameters for the origin request |
%origin.request.ip% | The IP address for the origin request |
%origin.request.host% | Origin host name and port for requests that resulted in an origin pull. Example: myorigin.com:8000 |
%origin.request.hostOnly% | The host name for the origin request |
%origin.request.pathOnly% | Only the File path for the origin request |
%origin.request.port% | The port for the origin request |
%origin.request.filename% | The filename for the origin request |
%origin.request.fullFilePath% | The Full File Path for the origin request |
%origin.request.protocol% | The protocol of the origin request |
%origin.request.fullUrl% | The Full url for the origin request |
%origin.response.firstByteDuration% | The first bite duration for the origin response |
Use Case: Redirect HTTP Traffic to HTTPS
In the example below we're going to update a Scope to include a configuration policy paired with a few expansion variables in order to redirect all HTTP traffic on that Scope to HTTPS.
Specifically, we will update the Scope with Scope ID matching "654321" to include the Cache Rule (dynamicCacheRule), which is a Delivery policy, and pair that policy with a handful of the expansion variables from the list of expansion variables to redirect HTTP traffic to HTTPS.
- Set the value for the headers parameter to include the
%client.request.host%
,client.request.fullfilepath%
, and%client.request.params%
expansion variables. - Set the pathFilter parameter to
http://*
. - Set the statusCode parameter to
301
.
API Request:
Method: PUT
Authorization: Bearer token
URL: https://striketracker.highwinds.com/api/v1/accounts/{account_id}/hosts/{host_id}/configuration/{scope_id}
Request Body:
{
"dynamicCacheRule": [
{
"comment": "Redirect all HTTP traffic to HTTPS",
"headerFilter": "*",
"headers": "Location: https://%client.request.host%%client.request.fullfilepath%%client.request.params%",
"methodFilter": "*",
"pathFilter": "http://*",
"statusCode": "301"
}
]
}