Added back X_REQUEST_ID, frankenphp doesn't include it by default.
This commit is contained in:
@@ -57,6 +57,9 @@ set_exception_handler(function (Throwable $e) {
|
||||
});
|
||||
|
||||
$factory = new Psr17Factory();
|
||||
if (!isset($_SERVER['X_REQUEST_ID'])) {
|
||||
$_SERVER['X_REQUEST_ID'] = generateUUID();
|
||||
}
|
||||
$request = new ServerRequestCreator($factory, $factory, $factory, $factory)->fromGlobals();
|
||||
$profiler = new Profiler(callback: function (array $data) {
|
||||
$filter = function (array $data): array {
|
||||
@@ -159,7 +162,7 @@ $exitCode = $profiler->process(function () use ($request) {
|
||||
try {
|
||||
// -- In case the frontend proxy does not generate request unique id.
|
||||
if (!isset($_SERVER['X_REQUEST_ID'])) {
|
||||
$_SERVER['X_REQUEST_ID'] = bin2hex(random_bytes(16));
|
||||
$_SERVER['X_REQUEST_ID'] = generateUUID();
|
||||
}
|
||||
|
||||
$app = new App\Libs\Initializer()->boot();
|
||||
|
||||
@@ -211,6 +211,7 @@ if (!function_exists('APIRequest')) {
|
||||
'SERVER_NAME' => 'localhost',
|
||||
'SERVER_PORT' => 80,
|
||||
'HTTP_USER_AGENT' => Config::get('http.default.options.headers.User-Agent', 'APIRequest'),
|
||||
'X_REQUEST_ID' => generateUUID('intr'),
|
||||
...ag($opts, 'server', []),
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user