### 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)

flask_app.config["SESSION_COOKIE_SECURE"] = conf.getboolean("webserver", "COOKIE_SECURE")
    cookie_samesite_config = conf.get("webserver", "COOKIE_SAMESITE")
    if cookie_samesite_config == "":
        warnings.warn(
            "Old deprecated value found for `cookie_samesite` option in `[webserver]` section. "
            "Using `Lax` instead. Change the value to `Lax` in airflow.cfg to remove this warning.",
            RemovedInAirflow3Warning,
        )
        cookie_samesite_config = "Lax"
    flask_app.config["SESSION_COOKIE_SAMESITE"] = cookie_samesite_config
    if config:
        flask_app.config.from_mapping(config)
    if "SQLALCHEMY_ENGINE_OPTIONS" not in flask_app.config:
        flask_app.config["SQLALCHEMY_ENGINE_OPTIONS"] = settings.prepare_engine_args()
    
    flask_app.json_provider_class = AirflowJsonProvider
    flask_app.json = AirflowJsonProvider(flask_app)
    InternalApiConfig.force_database_direct_access()
    csrf.init_app(flask_app)
    init_wsgi_middleware(flask_app)
    db = SQLA()
    db.session = settings.Session
    db.init_app(flask_app)
    init_dagbag(flask_app)
    init_api_experimental_auth(flask_app)
    init_robots(flask_app)
    init_cache(flask_app)
    init_flash_views(flask_app)
    configure_logging()
    configure_manifest_files(flask_app)