Skip to content

Commit

Permalink
Merge pull request #354 from gdebrauwer/stateful-domain-config-option
Browse files Browse the repository at this point in the history
Api stateful domains config option
  • Loading branch information
arukompas authored Apr 8, 2024
2 parents eeb391b + b6193e1 commit 873ec61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/log-viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
\Opcodes\LogViewer\Http\Middleware\AuthorizeLogViewer::class,
],

'api_stateful_domains' => env('LOG_VIEWER_API_STATEFUL_DOMAINS') ? explode(',', env('LOG_VIEWER_API_STATEFUL_DOMAINS')) : null,

/*
|--------------------------------------------------------------------------
| Log Viewer Remote hosts.
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/EnsureFrontendRequestsAreStateful.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function fromFrontend($request)
$domain = Str::replaceFirst('http://', '', $domain);
$domain = Str::endsWith($domain, '/') ? $domain : "{$domain}/";

$stateful = array_filter(config('sanctum.stateful', self::defaultStatefulDomains()));
$stateful = array_filter(config('log-viewer.api_stateful_domains') ?? config('sanctum.stateful') ?? self::defaultStatefulDomains());

return Str::is(Collection::make($stateful)->map(function ($uri) {
return trim($uri).'/*';
Expand Down

0 comments on commit 873ec61

Please sign in to comment.