vitaly-krugl opened a new issue, #29167: URL: https://github.com/apache/airflow/issues/29167
### Apache Airflow version Other Airflow 2 version (please specify below) ### What happened Our app is using Airflow 2.3.2 and running the Airflow webserver. My team won't be able to upgrade to the latest airflow version for a long time, so logging the bug against version airflow v2.3.2. The issue: when accessing a non-existing endpoint, the airflow web server returns a malformed HTTP status line: `HTTP/1.1 b'404 Not Found'`. Note the "b" in front of the message and the single quotes surrounding the text - this is invalid in HTTP status line. ### What you think should happen instead Airflow web server must return a valid HTTP status line, such as ``` HTTP/1.1 404 Not Found ``` ### How to reproduce Make an HTTP request to a non-existent endpoint. Using wget - note the ERROR message printed by wget: `ERROR -1: Malformed status line` ``` wget -d http://localhost:80/healthhhhh DEBUG output created by Wget 1.20.3 on linux-gnu. Reading HSTS entries from /root/.wget-hsts URI encoding = 'ANSI_X3.4-1968' iconv UTF-8 -> ANSI_X3.4-1968 iconv outlen=60 inlen=30 converted 'http://localhost:80/healthhhhh' (ANSI_X3.4-1968) -> 'http://localhost:80/healthhhhh' (UTF-8) Converted file name 'healthhhhh' (UTF-8) -> 'healthhhhh' (ANSI_X3.4-1968) --2023-01-25 18:55:26-- http://localhost/healthhhhh Resolving localhost (localhost)... ::1, 127.0.0.1 Caching localhost => ::1 127.0.0.1 Connecting to localhost (localhost)|::1|:80... Closed fd 3 failed: Connection refused. Connecting to localhost (localhost)|127.0.0.1|:80... connected. Created socket 3. Releasing 0x0000564e6bfc8b90 (new refcount 1). ---request begin--- GET /healthhhhh HTTP/1.1 User-Agent: Wget/1.20.3 (linux-gnu) Accept: */* Accept-Encoding: identity Host: localhost Connection: Keep-Alive ---request end--- HTTP request sent, awaiting response... ---response begin--- HTTP/1.1 b'404 Not Found' Server: gunicorn Date: Wed, 25 Jan 2023 18:55:26 GMT Connection: close Transfer-Encoding: chunked Content-Type: text/plain ---response end--- -1 2023-01-25 18:55:26 ERROR -1: Malformed status line. Closed fd 3 ``` ### Operating System Ubuntu 5.10 ### Versions of Apache Airflow Providers _No response_ ### Deployment Other ### Deployment details _No response_ ### Anything else This bug appears to be isolated to the 404 NOT FOUND case. Here is another wget session which solicits the 400 BAD REQUEST response which is properly formatted and doesn't have the `b'` in front of the message. Note that this request passes an invalid query arg to api/v1/connections in order to coerce the 400 BAD REQUEST: ``` root@1b69c66c14af:/usr/local/akamai/abattery-app# wget -d http://localhost:80/airflow/api/v1/connections?zzz=123 --header "RemoteUser:vkruglik" Setting --header (header) to RemoteUser:vkruglik Setting --header (header) to RemoteUser:vkruglik DEBUG output created by Wget 1.20.3 on linux-gnu. Reading HSTS entries from /root/.wget-hsts URI encoding = 'ANSI_X3.4-1968' iconv UTF-8 -> ANSI_X3.4-1968 iconv outlen=108 inlen=54 converted 'http://localhost:80/airflow/api/v1/connections?zzz=123' (ANSI_X3.4-1968) -> 'http://localhost:80/airflow/api/v1/connections?zzz=123' (UTF-8) Converted file name 'connections?zzz=123' (UTF-8) -> 'connections?zzz=123' (ANSI_X3.4-1968) --2023-01-25 19:03:07-- http://localhost/airflow/api/v1/connections?zzz=123 Resolving localhost (localhost)... ::1, 127.0.0.1 Caching localhost => ::1 127.0.0.1 Connecting to localhost (localhost)|::1|:80... Closed fd 3 failed: Connection refused. Connecting to localhost (localhost)|127.0.0.1|:80... connected. Created socket 3. Releasing 0x0000563e23366e50 (new refcount 1). ---request begin--- GET /airflow/api/v1/connections?zzz=123 HTTP/1.1 User-Agent: Wget/1.20.3 (linux-gnu) Accept: */* Accept-Encoding: identity Host: localhost Connection: Keep-Alive RemoteUser: vkruglik ---request end--- HTTP request sent, awaiting response... ---response begin--- HTTP/1.1 400 BAD REQUEST Server: gunicorn Date: Wed, 25 Jan 2023 19:03:07 GMT Connection: close Content-Type: application/problem+json Content-Length: 210 Access-Control-Allow-Headers: Access-Control-Allow-Methods: Access-Control-Allow-Origin: X-Robots-Tag: noindex, nofollow ---response end--- 400 BAD REQUEST Closed fd 3 2023-01-25 19:03:07 ERROR 400: BAD REQUEST. ``` ### Are you willing to submit PR? - [ ] 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) -- 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]
