envoyproxy / envoyproxy/gateway

Unable to set or at least view additional http response headers via ResponseHeaderModifier

Open
#5,216 2 comments 0 reactions 0 assignees View on GitHub
stale triage
Dominant language
Go
Stars
3k
Forks
864
Avg merge
2d 2h
Merged PRs (30d)
140

Description

*Description*:
I am setting a filter `ResponseHeaderModifier` for an HTTPRoute resource but am not seeing the additional headers in the response with a verbose output.

Here is a snippet of the configuration
```
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
...
filters:
- type: ResponseHeaderModifier
responseHeaderModifier:
add:
- name: Content-Security-Policy
value: default-src 'self'
- name: Strict-Transport-Security
value: max-age=31536000; includeSubDomains; preload
- name: X-Content-Type-Options
value: nosniff
```

Then `curl -v ` returns

```
* Request completely sent off
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Wed, 05 Feb 2025 18:49:12 GMT
< Content-Length: 7
```

I would have expected but I may be misunderstanding the filter modifier?

```
* Request completely sent off
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Wed, 05 Feb 2025 18:49:12 GMT
< Content-Length: 7
< Content-Security-Policy: default-src 'self'
< Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
< X-Content-Type-Options: nosniff
```

[optional *Relevant Links*:]
[Envoy proxy adding response headers](https://gateway.envoyproxy.io/docs/tasks/traffic/http-response-headers/#adding-response-headers)

Using envoy v 1.1.x

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.