Enable enhanced debug headers

To return enhanced debug information, also known as secure trace headers, add a user-defined variable to your property. You then need to use the EdgeWorkers CLI to create a secret key. This secret key must be added to the user-defined variable and then used to generate an authentication token.

For responseProvider you need to add the Pragma akamai-x-ew-debug-rp header that enables the multi-part response header. See for Enable and view JavaScript Logging for more information.

How to

  1. Add a user-defined variable named, EW_DEBUG_KEY to your property. See User-defined variables for more information.
  2. Use this EdgeWorkers CLI command to generate a secret key:
    akamai edgeworkers secret
    Here’s an example of a secret key (this token is an example and cannot be used in your user-defined variable or to generate an authentication token):
    fef77a483a6dd85b45a6c5092f1c178a6eaf21e56a3b69195e33f53070eec669
    
  3. Enter the secret key you created in step 2 into the Initial Value column of the user-defined variable.
    You'll also use this secret key, in addition to other input parameters, when using the CLI to generate the authentication token.
  4. Select the Sensitive Security Setting to prevent exposing the key.
  5. Use the secret key you created in step 2 to generate an authentication token using this command in the EdgeWorkers CLI. In this example we set the authorization token expiry to 30 minutes and limited the secure trace headers to the URLs within the specified path.
    akamai edgeworkers auth --expiry 30 --acl /example-path fef77a483a6dd85b45a6c5092f1c178a6eaf21e56a3b69195e33f53070eec669
    Note: The --acl /example-path part of the command is optional. It is used to limit the authentication token to specific paths on the domain.
  6. Activate your EdgeWorkers code bundle.
  7. To receive enhanced debugging information add the following request header to your requests .
    curl "http://www.example.com" -H 'Pragma: akamai-x-ew-debug' -H 'Akamai-EW-Trace: st=1601393394~exp=1601395194~acl=/*~hmac=89ec982c9098536d82ad7c24232578a4fdee88739e7c75c9c371be66b6fe614b'
    Here's an example of enhanced debug information:
    HTTP/2 200
    content-type: application/json
    date: Fri, 16 Oct 2020 21:05:28 GMT
    content-length: 65
    server-timing: cdn-cache; desc=HIT
    server-timing: edge; dur=2153
    x-akamai-edgeWorker-onclientresponse-log: D:main.js:16 iron\r\nx-akamai-edgeworker-onclientresponse-info: ew=<your EdgeWorker ID> v1.0:example; status=Success; status_msg=-; wall_time=0.500; cpu_time=0.400; memory_usage=2464
    x-akamai-edgeworker-onclientrequest-info: ew=<your EdgeWorker ID> v1.0:example; status=UnimplementedEventHandler; status_msg=-; wall_time=0; cpu_time=0; memory_usage=229836