-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add http header modification feature
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Module included in the following assemblies: | ||
// | ||
// * networking/ingress-operator.adoc | ||
|
||
:_content-type: PROCEDURE | ||
[id="nw-ingress-add-http-headers_{context}"] | ||
= Setting or deleting HTTP request and response headers | ||
|
||
Certain HTTP request and response headers might need to be set or deleted for compliance purposes or other reasons. You can set or delete these headers either for all routes served by an Ingress Controller or for specific routes. | ||
|
||
For example, you might want to migrate an application running on your cluster to use mutual TLS, which requires that your application check for an X-Forwarded-Client-Cert request header, but the {product-title} default Ingress Controller provides an X-SSL-Client-Der request header. | ||
|
||
The following procedure modifies the Ingress Controller to set the X-Forwarded-Client-Cert request header, and delete the X-SSL-Client-Der request header. | ||
|
||
.Prerequisites | ||
. You have installed the OpenShift CLI (`oc`). | ||
. You have access to an {product-title} cluster as a user with the `cluster-admin` role. | ||
|
||
.Procedure | ||
. Edit the Ingress Controller resource: | ||
+ | ||
[source,terminal] | ||
---- | ||
$ oc -n openshift-ingress-operator edit ingresscontroller/default | ||
---- | ||
|
||
. Replace the X-SSL-Client-Der HTTP request header with the X-Forwarded-Client-Cert HTTP request header: | ||
+ | ||
[source,yaml] | ||
---- | ||
apiVersion: operator.openshift.io/v1 | ||
kind: IngressController | ||
metadata: | ||
name: default | ||
namespace: openshift-ingress-operator | ||
spec: | ||
httpHeaders: | ||
actions: <1> | ||
request: <2> | ||
- name: X-Forwarded-Client-Cert <3> | ||
action: | ||
type: Set <4> | ||
set: | ||
value: "%{+Q}[ssl_c_der,base64]" <5> | ||
- name: X-SSL-Client-Der | ||
action: | ||
type: Delete | ||
---- | ||
<1> The list of actions you want to perform on the HTTP headers. | ||
<2> The type of header you want to change. In this case, a request header. | ||
<3> The name of the header you want to change. For a list of available headers you can set or delete, see xxx. | ||
<4> The type of action being taken on the header. This field can have the value `Set` or `Delete`. | ||
<5> When setting HTTP headers, you must provide a `value`. The value can be a string from a set list of values accepted by HAProxy, for example `DENY`, or it can be a dynamic value that will be interpreted using HAProxy's dynamic value syntax. In this case, a dynamic value is added. | ||
+ | ||
Modifying HTTP headers using the Ingress Controller is a global change that will affect all routes served by the Ingress Controller. | ||
|
||
. Save the file to apply the changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters