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
> Ideally, the unique Correlation ID should be created at the **very first touch point** of your infrastructure like the initial server which could be a load balancer
33
+
> Ideally, the unique Correlation ID should be created at the **very first touch point** of your infrastructure like the initial server which could be a load balancer.
34
34
35
-
As it can be tricky to create _Correlation ID_ on the server level and this is so easy in Laravel using middleware. This package provides a middleware for creating a _Correlation ID_ and attaching it to the request as a header `Correlation-ID` and to the response header as well. You should either assign the correlation id on the first touch point of your infrastructure or register the `CorrelationIdMiddleware` middleware globally as the first middleware in the `$middleware` property of your `app/Http/Kernel.php` class:
35
+
As it can be tricky to create _Correlation ID_ on the server level (I do accept a PR with suggestions on how to do this in Nginx 😃) and this is so easy in Laravel using middleware. This package provides a middleware for creating a _Correlation ID_ and attaching it to the request as a header `Correlation-ID` and to the response header as well. You should assign the correlation id using a global middleware pushed as the first middleware to be applied.
36
+
37
+
#### Laravel 11
38
+
39
+
Registering a global middleware in Laravel 11 is done in the `bootstrap/app.php` file:
40
+
41
+
```php
42
+
// bootstrap/app.php
43
+
44
+
use App\Http\Middleware\EnsureTokenIsValid;
45
+
use Bilfeldt\CorrelationId\Middleware\CorrelationIdMiddleware
0 commit comments