Skip to content

Comments

Fix airflowctl auth login failing with trailing slash in api-url#61245

Merged
bugraoz93 merged 1 commit intoapache:mainfrom
emin-ozata:fix/airflowctl-trailing-slash-api-url
Jan 30, 2026
Merged

Fix airflowctl auth login failing with trailing slash in api-url#61245
bugraoz93 merged 1 commit intoapache:mainfrom
emin-ozata:fix/airflowctl-trailing-slash-api-url

Conversation

@emin-ozata
Copy link
Contributor

@emin-ozata emin-ozata commented Jan 30, 2026

Description

closes: #61244
Fixes an authentication failure triggered when airflowctl auth login --api-url is given a base URL with a trailing slash.

Problem

When users copy the Airflow base URL from their browser's address bar (which typically includes a trailing slash), the _get_base_url()
method concatenates it directly with path segments, creating malformed URLs with double slashes (e.g., http://localhost:8080//auth),
resulting in "Method Not Allowed" errors.

Solution

Normalize the base URL by stripping trailing slashes before constructing endpoint paths using rstrip("/") in the _get_base_url()
method.

Testing

Added test cases to verify URLs with trailing slashes are handled correctly for both CLI and AUTH client kinds.


Related Issues


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Jan 30, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@emin-ozata emin-ozata force-pushed the fix/airflowctl-trailing-slash-api-url branch from 89eedab to c52ded9 Compare January 30, 2026 09:41
@emin-ozata emin-ozata closed this Jan 30, 2026
@emin-ozata emin-ozata reopened this Jan 30, 2026
Copy link
Contributor

@Prab-27 Prab-27 left a comment

Choose a reason for hiding this comment

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

LGTM !!

@Prab-27
Copy link
Contributor

Prab-27 commented Jan 30, 2026

Thanks @emin-ozata !!

The URL Pattern mentioned in the doc The URL should be in the form of http(s)://<host>:<port>- here

This is helpful, since one could easily include it by mistake.

cc : @bugraoz93 - Could you please share your insight on this when you have some time ?

@bugraoz93
Copy link
Contributor

Thanks @emin-ozata !!

The URL Pattern mentioned in the doc The URL should be in the form of http(s)://<host>:<port>- here

This is helpful, since one could easily include it by mistake.

cc : @bugraoz93 - Could you please share your insight on this when you have some time ?

Agree, indeed, copy & paste from browsers can cause it, or similar. It makes sense!

@bugraoz93
Copy link
Contributor

Let's see the CI, and then we can merge it. Thanks @emin-ozata!

@bugraoz93 bugraoz93 force-pushed the fix/airflowctl-trailing-slash-api-url branch from c52ded9 to c2577b6 Compare January 30, 2026 18:10
@bugraoz93 bugraoz93 changed the title Fix airflowctl auth login failing with trailing slash in api-url (#61… Fix airflowctl auth login failing with trailing slash in api-url Jan 30, 2026
@bugraoz93
Copy link
Contributor

I added for you, but if you add closes:#<issue_number> or relates:#<issue_numer> It will automatically update the issue you have created

@bugraoz93 bugraoz93 merged commit dace247 into apache:main Jan 30, 2026
3 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 30, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

@bugraoz93
Copy link
Contributor

Congrats @emin-ozata! 🎉

morelgeorge pushed a commit to morelgeorge/airflow that referenced this pull request Feb 1, 2026
shashbha14 pushed a commit to shashbha14/airflow that referenced this pull request Feb 2, 2026
jason810496 pushed a commit to abhijeets25012-tech/airflow that referenced this pull request Feb 3, 2026
jhgoebbert pushed a commit to jhgoebbert/airflow_Owen-CH-Leung that referenced this pull request Feb 8, 2026
choo121600 pushed a commit to choo121600/airflow that referenced this pull request Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

airflowctl auth login fails when --api-url ends with trailing slash

3 participants