Skip to content

Commit 39c9db9

Browse files
authored
Merge pull request #80474 from dfitzmau/OCPBUGS-38432
OCPBUGS-38432: Added step to networking Converting HTTP header case s…
2 parents 024feb0 + 7c0439a commit 39c9db9

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

modules/nw-ingress-converting-http-header-case.adoc

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,55 +6,50 @@
66
[id="nw-ingress-converting-http-header-case_{context}"]
77
= Converting HTTP header case
88

9-
HAProxy lowercases HTTP header names by default, for example, changing `Host: xyz.com` to `host: xyz.com`. If legacy applications are sensitive to the capitalization of HTTP header names, use the Ingress Controller `spec.httpHeaders.headerNameCaseAdjustments` API field for a solution to accommodate legacy applications until they can be fixed.
9+
HAProxy lowercases HTTP header names by default; for example, changing `Host: xyz.com` to `host: xyz.com`. If legacy applications are sensitive to the capitalization of HTTP header names, use the Ingress Controller `spec.httpHeaders.headerNameCaseAdjustments` API field for a solution to accommodate legacy applications until they can be fixed.
1010

1111
[IMPORTANT]
1212
====
13-
Because {product-title} includes HAProxy 2.8, be sure to add the necessary configuration by using `spec.httpHeaders.headerNameCaseAdjustments` before upgrading.
13+
{product-title} includes HAProxy 2.8. If you want to update to this version of the web-based load balancer, ensure that you add the `spec.httpHeaders.headerNameCaseAdjustments` section to your cluster's configuration file.
1414
====
1515

16+
As a cluster administrator, you can convert the HTTP header case by entering the `oc patch` command or by setting the `HeaderNameCaseAdjustments` field in the Ingress Controller YAML file.
17+
1618
.Prerequisites
1719

1820
* You have installed the OpenShift CLI (`oc`).
1921
* You have access to the cluster as a user with the `cluster-admin` role.
2022
2123
.Procedure
2224

23-
As a cluster administrator, you can convert the HTTP header case by entering the `oc patch` command or by setting the `HeaderNameCaseAdjustments` field in the Ingress Controller YAML file.
25+
* Capitalize an HTTP header by using the `oc patch` command.
2426
25-
* Specify an HTTP header to be capitalized by entering the `oc patch` command.
26-
27-
. Enter the `oc patch` command to change the HTTP `host` header to `Host`:
27+
.. Change the HTTP header from `host` to `Host` by running the following command:
2828
+
2929
[source,terminal]
3030
----
3131
$ oc -n openshift-ingress-operator patch ingresscontrollers/default --type=merge --patch='{"spec":{"httpHeaders":{"headerNameCaseAdjustments":["Host"]}}}'
3232
----
3333
+
34-
. Annotate the route of the application:
35-
+
36-
[source,terminal]
37-
----
38-
$ oc annotate routes/my-application haproxy.router.openshift.io/h1-adjust-case=true
39-
----
40-
+
41-
The Ingress Controller then adjusts the `host` request header as specified.
42-
43-
//Extra example if needed
44-
////
45-
* This example changes the HTTP `cache-control` header to `Cache-Control`:
34+
.. Create a `Route` resource YAML file so that the annotation can be applied to the application.
4635
+
47-
[source,terminal]
36+
.Example of a route named `my-application`
37+
[source,yaml]
4838
----
49-
$ oc -n openshift-ingress-operator patch ingresscontrollers/default --type=json --patch='[{"op":"add","path":"/spec/httpHeaders/headerNameCaseAdjustments/-","value":"Cache-Control"}]'
39+
apiVersion: route.openshift.io/v1
40+
kind: Route
41+
metadata:
42+
annotations:
43+
haproxy.router.openshift.io/h1-adjust-case: true <1>
44+
name: <application_name>
45+
namespace: <application_name>
46+
# ...
5047
----
51-
+
52-
The Ingress Controller adjusts the `cache-control` response header as specified.
53-
////
48+
<1> Set `haproxy.router.openshift.io/h1-adjust-case` so that the Ingress Controller can adjust the `host` request header as specified.
5449

55-
* Specify adjustments using the `HeaderNameCaseAdjustments` field by configuring the Ingress Controller YAML file.
50+
* Specify adjustments by configuring the `HeaderNameCaseAdjustments` field in the Ingress Controller YAML configuration file.
5651
57-
. The following example Ingress Controller YAML adjusts the `host` header to `Host` for HTTP/1 requests to appropriately annotated routes:
52+
.. The following example Ingress Controller YAML file adjusts the `host` header to `Host` for HTTP/1 requests to appropriately annotated routes:
5853
+
5954
.Example Ingress Controller YAML
6055
[source,yaml]
@@ -70,7 +65,7 @@ spec:
7065
- Host
7166
----
7267
+
73-
. The following example route enables HTTP response header name case adjustments using the `haproxy.router.openshift.io/h1-adjust-case` annotation:
68+
.. The following example route enables HTTP response header name case adjustments by using the `haproxy.router.openshift.io/h1-adjust-case` annotation:
7469
+
7570
.Example route YAML
7671
[source,yaml]

0 commit comments

Comments
 (0)