potiuk commented on code in PR #37638:
URL: https://github.com/apache/airflow/pull/37638#discussion_r1509398492


##########
airflow/www/app.py:
##########
@@ -70,7 +72,27 @@
 
 def create_app(config=None, testing=False):
     """Create a new instance of Airflow WWW app."""
-    flask_app = Flask(__name__)
+    connexion_app = connexion.FlaskApp(__name__)
+
+    @connexion_app.app.before_request
+    def before_request():
+        """Exempts the view function associated with '/api/v1' requests from 
CSRF protection."""
+        if request.path.startswith("/api/v1"):  # TODO: make sure this path is 
correct

Review Comment:
   Answering the question about the paths here - this execamption shoult be 
done for all the API endpoints - so basicaly anything that is stored in ` 
init_views.base_paths` -> all the API  endpoints will register itself there - 
for example:
   
   ```python
       base_path = "/api/v1"
       base_paths.append(base_path)
   ```
   
   And and - we should be able to add exemption when path starts with any of 
the api urls registered there.
   



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to