Skip to content

Add Content-Length header to preflight response#11682

Merged
traefiker merged 2 commits intotraefik:v2.11from
lbenguigui:fix_add_content_length
Apr 16, 2025
Merged

Add Content-Length header to preflight response#11682
traefiker merged 2 commits intotraefik:v2.11from
lbenguigui:fix_add_content_length

Conversation

@lbenguigui
Copy link
Contributor

What does this PR do?

This PR ensures that a Content-Length: 0 header is included in the response when a preflight OPTIONS request is handled by the headers middleware.

Motivation

This change addresses an issue that occurs when the buffer middleware is used before in the middleware chain. Without an explicit Content-Length, the response may be misinterpreted as having a body, leading to unexpected error.

More

  • Added/updated tests
  • Added/updated documentation

@traefiker traefiker added this to the 2.11 milestone Apr 11, 2025
@lbenguigui lbenguigui changed the title fix: add Content-Length on response on preFlight request fix: add Content-Length header to preflight response Apr 11, 2025
Copy link
Contributor

@sdelicata sdelicata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevinpollet kevinpollet changed the title fix: add Content-Length header to preflight response Add Content-Length header to preflight response Apr 15, 2025
@kevinpollet kevinpollet force-pushed the fix_add_content_length branch from 2448fc3 to b0c845a Compare April 16, 2025 12:47
Copy link
Member

@rtribotte rtribotte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@traefiker traefiker merged commit 545f2fe into traefik:v2.11 Apr 16, 2025
40 checks passed
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.

5 participants