### Apache Airflow version

2.6.3

### What happened

Hi, I would like to pass a custom [WSGI Middleware](https://medium.com/swlh/creating-middlewares-with-python-flask-166bd03f2fd4) to the underlying flask server.

I could theoretically do so in *webserver_config.py* by accessing `flask.current_app`:

```python
# webserver_config.py

from flask import current_app
from airflow.www.fab_security.manager import AUTH_REMOTE_USER

class MyAuthMiddleware:
    def __init__(self, wsgi_app) -> None:
        self.wsgi_app = wsgi_app

    def __call__(self, environ: dict, start_response):
        print("--> Custom authenticating logic")
        environ["REMOTE_USER"] = "username"
        return self.wsgi_app(environ, start_response)

current_app.wsgi_app = MyAuthMiddleware(current_app.wsgi_app)

AUTH_TYPE = AUTH_REMOTE_USER
```

But for this to work [the application context](https://flask.palletsprojects.com/en/2.3.x/appcontext/) should be pushed while reading the webserver config.

Thus https://github.com/apache/airflow/blob/fbeddc30178eec7bddbafc1d560ff1eb812ae37a/airflow/www/app.py#L84 should become

```python
with flask_app.app_context():
    flask_app.config.from_pyfile(settings.WEBSERVER_CONFIG, silent=True)
```

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

import_all_models()
    with flask_app.app_context():
        init_appbuilder(flask_app)
        init_appbuilder_views(flask_app)
        init_appbuilder_links(flask_app)
        init_plugins(flask_app)
        init_error_handlers(flask_app)
        init_api_connexion(flask_app)
        if conf.getboolean("webserver", "run_internal_api", fallback=False):
            if not _ENABLE_AIP_44:
                raise RuntimeError("The AIP_44 is not enabled so you cannot use it.")
            init_api_internal(flask_app)
        init_api_experimental(flask_app)
        sync_appbuilder_roles(flask_app)
        init_jinja_globals(flask_app)
        init_xframe_protection(flask_app)
        init_airflow_session_interface(flask_app)
        init_check_user_active(flask_app)
    return flask_app
def cached_app(config=None, testing=False):
    """Return cached instance of Airflow WWW app."""
    global app
    if not app:
        app = create_app(config=config, testing=testing)
    return app
def purge_cached_app():
    """Removes the cached version of the app in global state."""
    global app
    app = None