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:

  1. Turn off the Hidden and Sensitive attributes for all your user-defined variables.

    📘

    Remember to turn Hidden and Sensitive back on after testing.

  2. Save the configuration and push to the ​Akamai​ staging network.

  3. Edit your local host's file and point your hostname to the ​Akamai​ staging network.

    1. 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
      
    2. 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
      
    3. Edit the local hosts file on your machine. The path is /etc/hosts on Mac/Linux and C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS on most Windows machines.

    4. Add an entry for your hostname and the staging IP address and save the hosts file.

      IP AddressHostname
      127.0.0.1localhost
      23.45.180.182www.akamai.com
  4. 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-Infoheaders. The presence of the X-Akamai-Stagingresponse 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-Inforesponse 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.