response->redirectTo($this->url->to($path), $status, $headers); } public function back(int $status = 302, array $headers = []): Response { return $this->to($this->getPreviousUrl(), $status, $headers); } protected function getPreviousUrl(): string { if ($header = $this->request->getHeader('referer')) { return array_pop($header); } return '/'; } }