Skip to content

Conversation

@ashb
Copy link
Member

@ashb ashb commented Mar 10, 2025

Previously we had both a <base href=""> tag and a <meta name="backend-server-base-url" content=""> tag that contained almost the same
value -- one had a trailing / and the other didn't.

That irked me, so I updated things so the XHR requests take the URL based on
the <base> tag instead.

In order to make this change I made the following changes:

  • Instead of erroring if the URL does have a trailing /, the behaviour is
    now to add it if it's missing. This makes it easier kn users
  • This necessitated updating the Auth Managers to use a proper URL function,
    not string concatenation, to build the URLs

The change to conf.set is a side-effect/fix to allow conf.set("api", "base_url") to work -- otherwise it errored with "No section found" with only
the defaults present


^ 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 newsfragments.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:providers area:UI Related to UI/UX. For Frontend Developers. provider:amazon AWS/Amazon - related issues provider:fab labels Mar 10, 2025
@ashb ashb removed provider:amazon AWS/Amazon - related issues area:providers provider:fab labels Mar 10, 2025
@pierrejeambrun
Copy link
Member

Let me just try this locally, one moment please :)

@ashb
Copy link
Member Author

ashb commented Mar 10, 2025

@pierrejeambrun Please. It seemed to work find for me in dev and prod modes

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Mar 10, 2025

I am having trouble making it work with a URL prefix, any hint for me ?

Basically setting the base_url to http://localhost:28080/d12345/ (you might need to provide AIRFLOW__API__BASE_URL env variable to breeze too). The front-end should be on http://localhost:28080/d12345/ but there seem to be some routing problem I have a blank page.

If I manually go to the dag page I end up with this:
Screenshot 2025-03-10 at 17 26 30

Let me know if you managed to reproduced or if you want me to take a look. That might just be on my side though.

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Mar 10, 2025

Well, I just tried on main and things do not seem to work anymore either..... :( but the errors are different

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.

Maybe later we will still want two settings in case the static file are hosted somewhere else (cdn) but for now that's much cleaner.

@ashb ashb force-pushed the single-base-url-for-ui branch 3 times, most recently from 3d83702 to 7dcc872 Compare March 11, 2025 11:21
…ot two

Previously we had both a `<base href="">` tag and a `<meta
name="backend-server-base-url" content="">` tag that contained almost the same
value -- one had a trailing `/` and the other didn't.

That irked me, so I updated things so the XHR requests take the URL based on
the `<base>` tag instead.

In order to make this change I made the following changes:
 - Instead of erroring if the URL does have a trailing `/`, the behaviour is
   now to add it if it's missing. This makes it easier kn users
 - This necessitated updating the Auth Managers to use a proper URL function,
   not string concatenation, to build the URLs

The change to `conf.set` is a side-effect/fix to allow `conf.set("api",
"base_url")` to work -- otherwise it errored with "No section found" with only
the defaults present
@ashb ashb force-pushed the single-base-url-for-ui branch from 7dcc872 to 89caf69 Compare March 11, 2025 13:42
@ashb ashb merged commit 245d26d into main Mar 11, 2025
89 checks passed
@ashb ashb deleted the single-base-url-for-ui branch March 11, 2025 15:34
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
…ot two (apache#47572)

Previously we had both a `<base href="">` tag and a `<meta
name="backend-server-base-url" content="">` tag that contained almost the same
value -- one had a trailing `/` and the other didn't.

That irked me, so I updated things so the XHR requests take the URL based on
the `<base>` tag instead.

In order to make this change I made the following changes:
 - Instead of erroring if the URL does have a trailing `/`, the behaviour is
   now to add it if it's missing. This makes it easier kn users
 - This necessitated updating the Auth Managers to use a proper URL function,
   not string concatenation, to build the URLs

The change to `conf.set` is a side-effect/fix to allow `conf.set("api",
"base_url")` to work -- otherwise it errored with "No section found" with only
the defaults present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants