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

from airflow.www.extensions.init_jinja_globals import init_jinja_globals
from airflow.www.extensions.init_manifest_files import configure_manifest_files
from airflow.www.extensions.init_robots import init_robots
from airflow.www.extensions.init_security import (
    init_api_experimental_auth,
    init_check_user_active,
    init_xframe_protection,
)
from airflow.www.extensions.init_session import init_airflow_session_interface
from airflow.www.extensions.init_views import (
    init_api_connexion,
    init_api_experimental,
    init_api_internal,
    init_appbuilder_views,
    init_error_handlers,
    init_flash_views,
    init_plugins,
)
from airflow.www.extensions.init_wsgi_middlewares import init_wsgi_middleware
app: Flask | None = None
csrf = CSRFProtect()
def sync_appbuilder_roles(flask_app):
    """Sync appbuilder roles to DB."""
    
    
    
    
    if conf.getboolean("webserver", "UPDATE_FAB_PERMS"):
        flask_app.appbuilder.sm.sync_roles()
def create_app(config=None, testing=False):