Fix doc about removing headers
This commit is contained in:
parent
2e19e45aa4
commit
b0b8b75258
2 changed files with 10 additions and 11 deletions
|
@ -43,13 +43,10 @@ spec:
|
|||
|
||||
### Adding and Removing Headers
|
||||
|
||||
`X-Script-Name` header added to the proxied request, the `X-Custom-Request-Header` header removed from the request, and the `X-Custom-Response-Header` header removed from the response.
|
||||
`X-Script-Name` header added to the proxied request, the `X-Custom-Request-Header` header removed from the request,
|
||||
and the `X-Custom-Response-Header` header removed from the response.
|
||||
|
||||
```yaml tab="Docker"
|
||||
labels:
|
||||
- "traefik.http.middlewares.testHeader.Headers.CustomRequestHeaders.X-Script-Name=test"
|
||||
- "traefik.http.middlewares.testHeader.Headers.CustomResponseHeaders.X-Custom-Response-Header=True"
|
||||
```
|
||||
Please note that is not possible to remove headers through the use of Docker labels for now.
|
||||
|
||||
```yaml tab="Kubernetes"
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
|
@ -59,18 +56,20 @@ metadata:
|
|||
spec:
|
||||
headers:
|
||||
CustomRequestHeaders:
|
||||
X-Script-Name: "test"
|
||||
X-Script-Name: "test" # Adds
|
||||
X-Custom-Request-Header: "" # Removes
|
||||
CustomResponseHeaders:
|
||||
X-Custom-Response-Header: "True"
|
||||
X-Custom-Response-Header: "" # Removes
|
||||
```
|
||||
|
||||
```toml tab="File"
|
||||
[http.middlewares]
|
||||
[http.middlewares.testHeader.headers]
|
||||
[http.middlewares.testHeader.headers.CustomRequestHeaders]
|
||||
X-Script-Name = "test"
|
||||
X-Script-Name = "test" # Adds
|
||||
X-Custom-Request-Header = "" # Removes
|
||||
[http.middlewares.testHeader.headers.CustomResponseHeaders]
|
||||
X-Custom-Response-Header = "True"
|
||||
X-Custom-Response-Header = "" # Removes
|
||||
```
|
||||
|
||||
### Using Security Headers
|
||||
|
|
|
@ -166,7 +166,7 @@ func (s *Header) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// modifyRequestHeaders set or delete request headers.
|
||||
// modifyRequestHeaders sets or deletes request headers.
|
||||
func (s *Header) modifyRequestHeaders(req *http.Request) {
|
||||
// Loop through Custom request headers
|
||||
for header, value := range s.headers.CustomRequestHeaders {
|
||||
|
|
Loading…
Reference in a new issue