Enhanced debug headers for responseProvider

To enable enhanced debug headers for the responseProvider event handler the debug request must pass:

  • An Akamai-EW-Trace request header that contains a secure authentication token. For more information see, Add a secret key to your property .

  • The Pragma: akamai-x-ew-debug-rp header that enables the multi-part response.

When you include the responseProvider debug Pragma header, akamai-x-ew-debug-rp in the request, the AK_EDGEWORKERS_RP_STATUS built-in variable:

  • Returns an inaccurate status.
  • Indicates success, even on a failure.
  • Prevents the Site Failover behavior from responding to an EdgeWorkers failover accurately.

To resolve this issue you need to remove the akamai-x-ew-debug-rp Pragma header when testing Site Failover.

  1. Use this EdgeWorkers CLI command to generate an authentication token. In this example we set the token expiry to 60 minutes for the www.example.com hostname.
akamai edgeworkers auth --expiry 60 www.example.com
  1. Here’s an example of an enhanced debug request header:
curl http://www.example.com -H 'Pragma: akamai-x-ew-debug, akamai-x-ew-debug-rp' -H 'Akamai-EW-Trace: exp=1600166650~acl=/*~hmac=db4018160fab828da87d3fd8685bfbb9e0f1020885a9cce9403bcf3f5182477d' -k -sD -
  1. This example shows the trace response headers with successful execution of the responseProvider event handler:
HTTP/1.1 200 OK
Content-Type: multipart/form-data; boundary=bZsAiCmRhboH2gSI4GzC84
content-disposition: attachment
Date: Mon, 28 Jun 2021 19:09:30 GMT
Content-Length: 501
Connection: keep-alive
X-Akamai-EdgeWorker-onClientResponse-Info: ew=9 v7.0:EW for example.com; status=Success; status_msg=-; res_tier=200; init_wall_time=0; wall_time=0.855; init_cpu_time=0; cpu_time=0.159; memory_usage=96
X-Akamai-EdgeWorker-onClientRequest-Info: ew=9 v7.0:EW for example.com; status=Success; status_msg=-; res_tier=200; init_wall_time=0; wall_time=0.756; init_cpu_time=0; cpu_time=0.128; memory_usage=164

content-type: application/octet-stream
content-disposition: form-data; name="response-provider-body"

content-type: text/plain;charset=UTF-8
content-disposition: form-data; name="stream-trace"

X-Akamai-EdgeWorker-ResponseProvider-Info: ew=9 v7.0:EW for example.com; status=Success; status_msg=-; resource_tier=200; wall_time=1.923; cpu_time=0.242; memory_usage=101;req_body=streamed