-
Notifications
You must be signed in to change notification settings - Fork 5.5k
http: add HTTP/1.1 case preservation #15619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
f8b938c
7a47e28
8579832
7743a61
251cda7
b25b17e
29b8e59
977a50b
5a7bd40
e975787
a443664
163dbda
8f95245
9f4aae4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. | ||
|
|
||
| load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| api_proto_package( | ||
| deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.extensions.http.header_formatters.preserve_case.v3; | ||
|
|
||
| import "udpa/annotations/status.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.extensions.http.header_formatters.preserve_case.v3"; | ||
| option java_outer_classname = "PreserveCaseProto"; | ||
| option java_multiple_files = true; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
|
||
| // [#protodoc-title: Preserve case header formatter] | ||
| // [#extension: envoy.http.stateful_header_formatters.preserve_case] | ||
|
|
||
| // Configuration for the preserve case header formatter. | ||
| // See the :ref:`header casing <config_http_conn_man_header_casing>` configuration guide for more | ||
| // information. | ||
| message PreserveCaseFormatterConfig { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,4 @@ Extensions | |
| watchdog/watchdog | ||
| descriptors/descriptors | ||
| request_id/request_id | ||
| http/header_formatters | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| HTTP header formatters | ||
| ====================== | ||
|
|
||
| .. toctree:: | ||
| :glob: | ||
| :maxdepth: 2 | ||
|
|
||
| ../../extensions/http/header_formatters/*/v3/* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| static_resources: | ||
| listeners: | ||
| - address: | ||
| socket_address: | ||
| address: 0.0.0.0 | ||
| port_value: 443 | ||
| filter_chains: | ||
| - filters: | ||
| - name: envoy.filters.network.http_connection_manager | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
| stat_prefix: ingress_http | ||
| http_protocol_options: | ||
| header_key_format: | ||
| stateful_formatter: | ||
| name: preserve_case | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.extensions.http.header_formatters.preserve_case.v3.PreserveCaseFormatterConfig | ||
| http_filters: | ||
| - name: envoy.filters.http.router | ||
| route_config: | ||
| virtual_hosts: | ||
| - name: default | ||
| domains: ["*"] | ||
| routes: | ||
| - match: { prefix: "/" } | ||
| route: | ||
| cluster: service_foo | ||
| clusters: | ||
| - name: service_foo | ||
| connect_timeout: 15s | ||
| typed_extension_protocol_options: | ||
| envoy.extensions.upstreams.http.v3.HttpProtocolOptions: | ||
| "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions | ||
| explicit_http_config: | ||
| http_protocol_options: | ||
| header_key_format: | ||
| stateful_formatter: | ||
| name: preserve_case | ||
| typed_config: | ||
| "@type": type.googleapis.com/envoy.extensions.http.header_formatters.preserve_case.v3.PreserveCaseFormatterConfig | ||
| load_assignment: | ||
| cluster_name: some_service | ||
| endpoints: | ||
| - lb_endpoints: | ||
| - endpoint: | ||
| address: | ||
| socket_address: | ||
| address: 127.0.0.1 | ||
| port_value: 8080 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,46 @@ | ||
| .. _config_http_conn_man_header_casing: | ||
|
|
||
| HTTP/1.1 Header Casing | ||
| ====================== | ||
|
|
||
| When handling HTTP/1.1, Envoy will normalize the header keys to be all lowercase. While this is | ||
| compliant with the HTTP/1.1 spec, in practice this can result in issues when migrating | ||
| existing systems that might rely on specific header casing. | ||
|
|
||
| To support these use cases, Envoy allows configuring a formatting scheme for the headers, which | ||
| will have Envoy transform the header keys during serialization. To configure this formatting on | ||
| response headers, specify the format in the :ref:`http_protocol_options <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.http_protocol_options>`. | ||
| To configure this for upstream request headers, specify the formatting in :ref:`http_protocol_options <envoy_v3_api_msg_extensions.upstreams.http.v3.HttpProtocolOptions>` in the Cluster's :ref:`extension_protocol_options<envoy_v3_api_field_config.cluster.v3.Cluster.typed_extension_protocol_options>`. | ||
| To support these use cases, Envoy allows :ref:`configuring a formatting scheme for the headers | ||
| <envoy_v3_api_field_config.core.v3.Http1ProtocolOptions.header_key_format>`, which will have Envoy | ||
| transform the header keys during serialization. | ||
|
|
||
| To configure this formatting on response headers, specify the format in the | ||
| :ref:`http_protocol_options | ||
| <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.http_protocol_options>`. | ||
| To configure this for upstream request headers, specify the formatting in | ||
| :ref:`http_protocol_options <envoy_v3_api_msg_extensions.upstreams.http.v3.HttpProtocolOptions>` in | ||
| the cluster's | ||
| :ref:`extension_protocol_options<envoy_v3_api_field_config.cluster.v3.Cluster.typed_extension_protocol_options>`. | ||
|
|
||
| Currently Envoy supports two mutually exclusive types of header key formatters: | ||
|
|
||
| Stateless formatters | ||
| -------------------- | ||
|
|
||
| Stateless formatters are run on encoding and do not depend on any previous knowledge of the headers. | ||
| An example of this type of formatter is the :ref:`proper case words | ||
| <envoy_v3_api_field_config.core.v3.Http1ProtocolOptions.HeaderKeyFormat.proper_case_words>` | ||
| formatter. These formatters are useful when converting from non-HTTP/1 to HTTP/1 or when stateful | ||
| formatting is not desired due to increased memory requirements. | ||
|
|
||
| Stateful formatters | ||
| ------------------- | ||
|
|
||
| Stateful formatters are instantiated on decoding, passed every decoded header, attached to the | ||
|
mattklein123 marked this conversation as resolved.
Outdated
|
||
| header map, and then available during encoding to format the headers prior to writing. Thus, they | ||
|
mattklein123 marked this conversation as resolved.
Outdated
|
||
| traverse the entire proxy stack. An example of this type of formatter is the :ref:`preserve case | ||
| formatter | ||
| <envoy_v3_api_msg_extensions.http.header_formatters.preserve_case.v3.PreserveCaseFormatterConfig>` | ||
| configured via the :ref:`stateful_formatter | ||
| <envoy_v3_api_field_config.core.v3.Http1ProtocolOptions.HeaderKeyFormat.stateful_formatter>` field. | ||
| The following is an example configuration which will preserve HTTP/1 header case across the proxy. | ||
|
|
||
| See :ref:`below <faq_configuration_timeouts_transport_socket>` for other connection timeouts. | ||
| on the :ref:`Cluster <envoy_v3_api_field_config.cluster.v3.Cluster.http_protocol_options>`. FIXME | ||
| .. literalinclude:: _include/preserve-case.yaml | ||
| :language: yaml | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.