Enhanced debug headers for responseProvider

To enable enhanced debug headers for the responseProvider event handler the debug request must pass the akamai-x-ew-debug-rp Pragma 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 a JWT authentication token. In this example we set the token expiry to 60 minutes for the www.example.com hostname. By default, the token expiry is set at 480 for 8 hours. You can set the token expiry to a value between 1 to 720 minutes.
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: eyJ0eXAiOiJKV1Qi ... iu1XOS9eJOl-54Yw
  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