diff --git a/framework/yii/base/ErrorHandler.php b/framework/yii/base/ErrorHandler.php index 1e6671bace..338a3921f4 100644 --- a/framework/yii/base/ErrorHandler.php +++ b/framework/yii/base/ErrorHandler.php @@ -90,6 +90,8 @@ class ErrorHandler extends Component $useErrorView = !YII_DEBUG || $exception instanceof UserException; $response = Yii::$app->getResponse(); + $response->getHeaders()->removeAll(); + if ($useErrorView && $this->errorAction !== null) { $result = Yii::$app->runAction($this->errorAction); if ($result instanceof Response) {