You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/18 22:54:13 UTC

[GitHub] [airflow] potiuk commented on issue #26375: Airflow Webserver returns incorrect HTTP Error Response for custom REST API endpoints

potiuk commented on issue #26375:
URL: https://github.com/apache/airflow/issues/26375#issuecomment-1250404168

   I think the problem is because connexion has a custom handler set for both 404 and 405 methods that in case of a call that does not match the API URL, will return `not_found` i.e. 404 - even if originally it was 405:
   
   https://github.com/apache/airflow/blob/main/airflow/www/extensions/init_views.py#L190
   
   ```
   
       @app.errorhandler(404)
       @app.errorhandler(405)
       def _handle_api_error(ex):
           if request.path.startswith(base_path):
               # 404 errors are never handled on the blueprint level
               # unless raised from a view func so actual 404 errors,
               # i.e. "no route for it" defined, need to be handled
               # here on the application level
               return common_error_handler(ex)
           else:
               return views.not_found(ex)
   ```
   
   I marked it as a "good first issue" and hopefully somoene will take care of it, but I think the most sure way to get it "quickly" by you is to try to fix it on your side and submit a PR fixing it @PadmajaPeri - this is quite a niche case and while it is technically 'not correct' to return 404 in this case, it is not likely to be a problem for many users, so it might be, it won't be fixed as quickly. But this one seems to be rather easy to fix for you - since you know Flask/Python and you should be able to even get it locally tested (and deploy a modified Airflow version with the fix) before you submit a PR with the fix.
   
   WDYT? Easy way to become one of > 2100 contributors to Airflow - mostly people like you who had a problem and ended up with contributing a fix.
   
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org