Skip to content

buffer: Synthesize content-length header in case of request buffering #7844

Closed

Description

@euroelessar

Description:
When envoy processes request with enabled buffering it reads the whole request into memory before sending headers to an upstream.
Is is possible to make Envoy populate content-length header in this case? It would help with some http/1.0 backends (which unfortunately still exist in the wild).

Another option would be to add http/1.0-compliant behavior as cluster option (based on the precedent of existing accept_http10 option).

Without either of this options Envoy tries to send chunked-encoded data, which is observed as empty body by http/1.0 server.

Relevant Links:

Activity

  1. added
    enhancement
    on Aug 7, 2019
  2. euroelessar commented on Aug 7, 2019

    @euroelessar
    ContributorAuthor

    I've made a quick prototype and this functionality (populating content-length) can be done as part of envoy.buffer plugin. It looks like no changes are required in envoy core itself.

    Should I send a pull request? Should it be made configurable or is it fine to always populate the header?

  3. mattklein123 commented on Aug 7, 2019

    @mattklein123
    Member

    Yeah IMO this is fine to do. I could go either way on config. On one hand it seems like the right thing to do, on the other hand it should be strictly spec compliant. Maybe just add a runtime guard to turn it off and we can remove the guard after a release or two? WDYT?

  4. added this to the 1.12.0 milestone on Aug 7, 2019
  5. euroelessar commented on Aug 7, 2019

    @euroelessar
    ContributorAuthor

    To clarify, you suggest to (1) add this feature behind runtime flag, (2) enable this flag by default, (3) delete this flag in a release or two?
    This works for me, I'll send a pull request shortly.

  6. mattklein123 commented on Aug 7, 2019

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

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions