Skip to content

Webserver redirects to main page when user is not logged in #36832

Description

@csp33

Apache Airflow version

2.8.0

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When opening the log of a specific Airflow DAG/log/whatever (like <my airflow host>/log?execution_date=<date>&task_id=<task_id>&dag_id=<dag_id>&map_index=<map_index>), the user is redirected to the login page if he's not logged in.
However, when the login is performed, the homepage of the webserver is shown, instead of the URL that was initially opened.

What you think should happen instead?

No response

How to reproduce

  1. Enter into Airflow and copy the URL of a specific DAG (i.e <my host>/dags/<my_dag>/grid).
  2. Log out
  3. Paste the URL you copied -> you'll be redirected to the login page.
  4. Login
  5. See how you'll be redirected to the home page.

Operating System

Docker image

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

I found out that this logic is implemented in

def get_url_login(self, **kwargs) -> str:

return url_for(f"{self.security_manager.auth_view.endpoint}.login", next=kwargs["next_url"])

However, we're calling this function using next
return redirect(get_auth_manager().get_url_login(next=request.url))

Changing next to next_url should do the trick 😄

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions