diff --git a/airflow/www/views.py b/airflow/www/views.py index 377b6fbadd485..2ea074bc9b3ec 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -5162,7 +5162,8 @@ def varimport(self, session): failed_repr = ", ".join(repr(k) for k in sorted(existing_keys)) flash(f"Failed. The variables with these keys: {failed_repr} already exists.") logging.error(f"Failed. The variables with these keys: {failed_repr} already exists.") - return redirect(location=request.referrer) + self.update_redirect() + return redirect(self.get_redirect()) skipped = set() suc_count = fail_count = 0 for k, v in variable_dict.items():