mik-laj commented on a change in pull request #13620:
URL: https://github.com/apache/airflow/pull/13620#discussion_r555344211



##########
File path: airflow/www/extensions/init_views.py
##########
@@ -147,6 +147,20 @@ def init_error_handlers(app: Flask):
     app.register_error_handler(404, views.circles)
 
 
+def set_cors_headers_on_response(response):

Review comment:
       This code register this handler for each view.
   ```
   app.after_request(set_cors_headers_on_response)
   ```
   You should use 
[Blueprint.after_request](https://flask.palletsprojects.com/en/1.1.x/api/#flask.Blueprint.after_request).
  The api_ap variable contains an `flask.Blueprint` object. 
   

##########
File path: airflow/www/extensions/init_views.py
##########
@@ -171,6 +185,7 @@ def _handle_api_error(ex):
     api_bp = connexion_app.add_api(
         specification='v1.yaml', base_path=base_path, validate_responses=True, 
strict_validation=True
     ).blueprint
+    app.after_request(set_cors_headers_on_response)

Review comment:
       ```suggestion
       api_bp.after_request(set_cors_headers_on_response)
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to