Skip to content

Logout functionality should respect base_url config in api section #49545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

amoghrajesh
Copy link
Contributor

closes: #49534

The logout functionality should respect the "base_url" that is set. It wasn't doing so because there was a hardcoded occurrence: https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx#L35.

With base_url set:
Played around a bit on the console:

const baseHref = "/airflow/"
  const baseUrl = new URL(baseHref, globalThis.location.origin);
  const logoutPath = new URL("api/v2/auth/logout", baseUrl).pathname;


logoutPath
'/airflow/api/v2/auth/logout'

Without:

      const baseHref = document.querySelector("head>base")?.getAttribute("href") ?? "";
      const baseUrl = new URL(baseHref, globalThis.location.origin);
      const logoutPath = new URL("api/v2/auth/logout", baseUrl).pathname;
logoutPath
'/api/v2/auth/logout'

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Apr 22, 2025
@amoghrajesh amoghrajesh changed the title Logout functionality should respect base_url in api server Logout functionality should respect base_url config in api section Apr 22, 2025
@amoghrajesh amoghrajesh added this to the Airflow 3.0.1 milestone Apr 22, 2025
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks.

One small suggestion. But non blocking.

@amoghrajesh amoghrajesh merged commit d17ca5c into apache:main Apr 23, 2025
43 checks passed
@amoghrajesh amoghrajesh deleted the fix-base-url branch April 23, 2025 04:19
kaxil pushed a commit that referenced this pull request Apr 23, 2025
prabhusneha pushed a commit to astronomer/airflow that referenced this pull request Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logout broken if base_url has a suffix in 3.0.0rc4
3 participants