Skip to content

Fix duplicate Date headers in Flask WSGI responses#64726

Open
abhijeets25012-tech wants to merge 1 commit intoapache:mainfrom
abhijeets25012-tech:fix-duplicate-date-headers
Open

Fix duplicate Date headers in Flask WSGI responses#64726
abhijeets25012-tech wants to merge 1 commit intoapache:mainfrom
abhijeets25012-tech:fix-duplicate-date-headers

Conversation

@abhijeets25012-tech
Copy link
Copy Markdown
Contributor

What this PR does

This PR fixes an issue where duplicate Date headers appear in API responses when using Flask alongside Uvicorn.

Uvicorn already sets the Date header, and Flask adds another one during response processing, resulting in duplicate headers.

How this is fixed

An after_request hook is added to the Flask app to remove any existing Date headers before returning the response.

Why this approach

  • Keeps behavior consistent regardless of server configuration
  • Avoids modifying Uvicorn settings globally
  • Ensures compatibility with existing Flask middleware

Scope

  • Affects only Flask WSGI response handling
  • No impact on other components

Testing

  • Verified that responses no longer contain duplicate Date headers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant