do not use - Debug subWorkers
Enhanced debug headers for subWorkers
To receive enhanced debugging information about EdgeWorkers executions on sub-requests:
- Pass the
akamai-x-ew-subworkerspragma header. - Include the other pragma headers required for Enhanced debug headers.
- The debugging headers and pragmas are automatically forwarded on any sub-requests made by the EdgeWorker.
- The debug response headers are collected and returned on the response.
When you specify akamai-x-ew-subworkers, the following set of pragmas and headers are automatically forwarded on sub-requests.
*The akamai-x-ew-subworkers pragma response includes the Akamai-EW-Trace and the Akamai-X-EW-Subworkers-Log forward request headers.
Here’s an example of an enhanced debug request header that specifies the akamai-x-ew-subworkers pragma header:
This response shows that the main request returned three debug headers annotated with request ID 10f5e61. It indicates that the onClientRequest event ran successfully for EdgeWorker ID 1147649205. The onClientResponse event was not implemented.
Note that the Subrequests header shows a sub-request from the onClientRequest event. It has a request id of 10f5d16 and returned a 200 response. The sub-request also returned two debug headers annotated with request id 10f5d16.10f5e61. The onClientRequest event ran successfully for EdgeWorker ID 258567741 and the onClientResponse event was not implemented.
JWT authentication token security
If your subWorkers make calls to EdgeWorkers in different accounts you to need to add an Akamai-EW-Trace request header that contains a JSON Web Token (JWT) authentication token for each account. See Specify multiple trace headers for more information.
To keep the Akamai-EW-Trace tokens secure, headers are automatically removed from sub-requests:
- When a request is made to a property not encoded in the JWT authentication token. Any tokens are automatically removed from the request before running the property’s metadata.
- When the sub-request leaves the Akamai network and goes to origin.
Since tokens are removed when the sub-request crosses accounts, if a second sub-request is made again to another account, then that “grand-child” sub-request will not have appropriate trace headers for enhanced debugging. Review the following example for more information.
There are three properties on three accounts with trace headers EW-Trace-1, EW-Trace-2, and EW-Trace-3. When a request is made to Property A on account 1, that specifies all three trace headers:
-
All three headers are present on the initial request in account 1.
-
It makes a sub-request to a property on account 2, and forwards the trace headers.
- As the request enters account 2, it removes any trace headers for other accounts, leaving only account 2.
- A sub-request to a grand-child property account 3 that forwards the trace headers.
- As the request enters account 3, it removes trace headers for other accounts, leaving no trace headers.
- Additional sub-requests to other grand-child properties which belong to account 2 will keep their EW-Trace-2 token.
📘 A
Akamai-EW-Tracetoken can only be used in one other account. If, however, all properties belong to the same account, then the JWT tokens can propagate through the entire sub-request chain.
Specify multiple trace headers
SubWorkers let you make requests to EdgeWorkers created in different properties or accounts.
You need to specify an additional trace header for each separate property in an enhanced debug request header. For more information on how to create a JWT token, go the Enhanced debug headerssection in this guide.
To do this, add a second Akamai-EW-Trace header to the request.
EdgeWorkers requests automatically enable enhanced debugging if any of the Akamai-EW-Trace headers match and forwards the headers when the sub-request is invoked.
Response header limits
As the tree of a sub-request grows, so does the potential size of the response headers. There are limits imposed on the total size of headers collected from each of the main request’s event handlers. There are also limits on the total size of response headers in the entire request.
🚧 Question from Miranda
The Response header limits section: question to @Niefer, Andrew
There are limits imposed on the number of headers collected from each of the main request’s event handlers. There are also limits on the total number of response headers in the entire request.
Is it number of headers? Or size of headers? If it’s “number of headers”, then what are those limits?
If property modify max response size but we did NOT use PMUSER var to do override, then what takes precedence?
Debug response headers truncate results that exceed these limits. A truncated response header ends with a ’$’ character and is not always the last header.
The overall response header size limit applies to all response headers. It does not just apply to those collected via subWorkers debugging.
📘 > 🚧 Please confirm “increases from 32 KB to 48 KB”.
If you specify the
akamai-x-ew-subworkerspragma, and enable enhanced debugging via theAkamai-EW-Traceheader, then the maximum size of the response headers for the entire request increases from 32 KB to 48 KB. If the property is otherwise modifying the maximum response headers size, then this default may interfere with that setting. You can use aPMUSER_SW_HEADER_SIZE_OVERRIDEuser defined variable to change the subWorkers default.
subWorkers log header
Each EdgeWorkers event can generate a 1 KB log. This means that a single subWorker invocation can potentially generate a 4 KB log. This makes logging the largest contributor to the subWorkers debugging response headers.
If your log response headers are hitting these limits, making it difficult to debug a particular subWorker, you can specify the akamai-x-ew-subworkers-log request header. The value of this header should be a comma separated list of the EdgeWorker IDs you want to include in the logs. Any EdgeWorkers not on this list will not produce log headers for the request. If, however, you configured DataStream 2 for EdgeWorkers the EdgeWorker IDs not included in the list will appear in the DataStream 2 logs.
This request specify a single EdgeWorker ID to log akamai-x-ew-subworkers-log: 809212161.
This request specify multiple EdgeWorker IDs to log akamai-x-ew-subworkers-log: 809212161,29671799.