You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/incoming/filters.rst
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -386,20 +386,18 @@ Request ID
386
386
387
387
.. versionadded:: 4.8.0
388
388
389
-
This filter adds a unique request ID to each request in context of the application. This can be useful for
389
+
This filter adds a request ID to each request in context of the application. This can be useful for
390
390
debugging and logging purposes, as it allows you to trace a specific request through the application.
391
391
392
-
Framework-generated IDs are unique for practical purposes, however valid incoming IDs are reused.
392
+
Framework-generated IDs are 32-character hexadecimal strings and are unique for practical purposes, however valid incoming IDs are reused.
393
393
It is added to the request's context and can be accessed via the ``request_id`` key.
394
394
395
-
The ID is generated via ``bin2hex(random_bytes(16))``, so it is a 32-character hexadecimal string.
396
-
397
395
To enable this filter, simply add/uncomment the ``requestid`` alias in the ``$required['before']`` and ``$required['after']`` array in **app/Config/Filters.php**:
398
396
399
397
.. literalinclude:: filters/014.php
400
398
401
399
.. note:: If the incoming request has a header named ``X-Request-ID``, the value of that header
402
400
will be used as the request ID instead of generating a new one or checking for uniqueness.
403
401
The framework does basic validation to ensure that the incoming request ID is a non-empty string,
404
-
has at most 255 characters, and contains only valid characters (alphanumeric, dot, underscore, colon, and hyphen).
402
+
has at most 64 characters, and contains only valid characters (alphanumeric, dot, underscore, colon, and hyphen).
405
403
If the validation fails, a new request ID will be generated as normal. This allows you to pass in your own request ID if you have one available, such as from a client or a load balancer.
0 commit comments