diff --git a/config/telescope.php b/config/telescope.php index 1c9438fc3..a241a348e 100644 --- a/config/telescope.php +++ b/config/telescope.php @@ -143,7 +143,10 @@ 'ignore' => [], ], - Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + Watchers\ClientRequestWatcher::class => [ + 'enabled' => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), + 'ignore_hosts' => [], + ], Watchers\CommandWatcher::class => [ 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), diff --git a/src/Watchers/ClientRequestWatcher.php b/src/Watchers/ClientRequestWatcher.php index 00c61cda8..9cffca4fb 100644 --- a/src/Watchers/ClientRequestWatcher.php +++ b/src/Watchers/ClientRequestWatcher.php @@ -57,7 +57,8 @@ public function recordFailedRequest(ConnectionFailed $event) */ public function recordResponse(ResponseReceived $event) { - if (! Telescope::isRecording()) { + if (! Telescope::isRecording() || + $this->shouldIgnoreHost($event)) { return; } @@ -76,6 +77,19 @@ public function recordResponse(ResponseReceived $event) ); } + /** + * Determine whether to ignore this request based on its host. + * + * @param mixed $event + * @return bool + */ + protected function shouldIgnoreHost($event) + { + $host = $event->request->toPsrRequest()->getUri()->getHost(); + + return in_array($host, Arr::get($this->options, 'ignore_hosts', [])); + } + /** * Determine if the content is within the set limits. *