JC-comp opened a new pull request, #63406:
URL: https://github.com/apache/airflow/pull/63406
##### Description
The deployment environments result in a duplicated Date header—one generated
by the Flask application layer and another by the ASGI server. This PR
introduce `StripAppDateMiddleware` to remove the 'Date' header generated by the
application layer, ensuring that only one 'Date' header exists in the final
response.
```
$ curl -I localhost:8080/auth/static/pin_32.png
HTTP/1.1 200 OK
date: Thu, 12 Mar 2026 04:38:44 GMT <-- SENT BY uvicorn
server: uvicorn
content-disposition: inline; filename=pin_32.png
content-type: image/png
content-length: 1201
last-modified: Thu, 12 Mar 2026 01:43:44 GMT
cache-control: no-cache
etag: "1773279824.6871002-1201-1792155666"
date: Thu, 12 Mar 2026 04:38:44 GMT <-- DUPLICATE SENT BY FLASK
vary: Cookie
```
##### Changes
- New Middleware: Added `StripAppDateMiddleware` to intercept outgoing
responses.
- App Integration: Registered the middleware in the `FastAPI` initialization
flow.
- Unit Tests: Added automated tests to verify the header is removed from the
response.
##### How to Verify
Unit test suite:
1. Mocks a FastAPI request through the middleware.
2. Asserts that the `date` key is no longer present in the
`response.headers`.
Manual:
1. Run the api-server.
2. Make a request using curl.
```
$ curl -I localhost:8080/auth/static/pin_32.png
```
4. Confirm no duplicate date header.
--
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]