Test configurations with variables
Testing and debugging configurations with variables is more complex than regular configurations. It is best practice is to trap variable errors.
To test and debug your configuration with variables:
-
Turn off the Hidden and Sensitive attributes for all your user-defined variables.
Remember to turn Hidden and Sensitive back on after testing.
-
Save the configuration and push to the Akamai staging network.
-
Edit your local host's file and point your hostname to the Akamai staging network.
-
Do a DNS lookup on your hostname and note the edge hostname which is typically the first entry in the CNAME chain.
$ dig www.akamai.com www.akamai.com. 20 IN CNAME wwwsecure2.akamai.com.edgekey.net. wwwsecure2.akamai.com.edgekey.net. 20525 IN CNAME e8921.dscx.akamaiedge.net. e8921.dscx.akamaiedge.net. 20 IN A 23.220.185.26
-
Do a DNS lookup on the edge hostname. Add
-staging
after the domain name and note the resulting staging IP address:$ dig wwwsecure2.akamai.com.edgekey-staging.net wwwsecure2.akamai.com.edgekey-staging.net. 21600 IN CNAME e8921.dscx.akamaiedge-staging.net. e8921.dscx.akamaiedge-staging.net. 20 IN A 23.35.180.182
-
Edit the local hosts file on your machine. The path is
/etc/hosts
on Mac/Linux andC:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS
on most Windows machines. -
Add an entry for your hostname and the staging IP address and save the hosts file.
IP Address Hostname 127.0.0.1 localhost 23.45.180.182 www.akamai.com
-
-
Use a command-line tool such as wget or curl with the pragma debug headers to retrieve the variable values.
$ curl -H "Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no" -IXGET http://www.yourhostname.com/ HTTP/1.1 200 OK ... X-Akamai-Session-Info: name=PMUSER_FOO; value=something ... X-Akamai-Staging: ESSL
The variable values are returned in the X-Akamai-Session-Info
headers. The presence of the X-Akamai-Staging
response header confirms that your test request is indeed hitting our staging network. You can also install a browser plug-in/add-on that allows you to send the pragma debug request headers while you browse the page(s) and inspect the resulting X-Akamai-Session-Info
response headers with the variable values. For FireFox you can use the "Modify Headers" add-on to send the pragma headers, and Firebug to view the response headers.
Updated almost 3 years ago