contour icon indicating copy to clipboard operation
contour copied to clipboard

Support setting response headers for DirectResponsePolicy Routes

Open flawedmatrix opened this issue 1 year ago • 2 comments

I noticed that when I was trying to use a directResponsePolicy in a route, the responseHeadersPolicy would not actually take effect:

 routes:
  - conditions:
    - exact: /foo
    directResponsePolicy:
      statusCode: 200
    responseHeadersPolicy:
      set:
      - name: "Header-To-Add"
        value: "val"
$ curl -v https://example.site.com/foo
> GET /foo HTTP/2
> Host: example.site.com
> user-agent: curl/7.81.0
> accept: */*
...
< HTTP/2 200
< vary: Accept-Encoding
< date: Tue, 20 Feb 2024 23:43:58 GMT
< server: envoy

According to the Envoy docs, Direct Responses will include any headers specified in response_headers_to_add.

Perhaps this is a feature not yet added to Contour as response_headers_to_add is not populated in the case of a DirectResponse:

https://github.com/projectcontour/contour/blob/94e591fc8fab76c74a83d367b03e256062834ca5/internal/envoy/v3/route.go#L124-L125

flawedmatrix avatar Feb 20 '24 23:02 flawedmatrix

Hey @flawedmatrix! Thanks for opening your first issue. We appreciate your contribution and welcome you to our community! We are glad to have you here and to have your input on Contour. You can also join us on our mailing list and in our channel in the Kubernetes Slack Workspace

github-actions[bot] avatar Feb 20 '24 23:02 github-actions[bot]

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

github-actions[bot] avatar Apr 22 '24 00:04 github-actions[bot]

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

github-actions[bot] avatar Jul 02 '24 00:07 github-actions[bot]

The Contour project currently lacks enough contributors to adequately respond to all Issues.

This bot triages Issues according to the following rules:

  • After 60d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, the Issue is closed

You can:

  • Mark this Issue as fresh by commenting
  • Close this Issue
  • Offer to help out with triage

Please send feedback to the #contour channel in the Kubernetes Slack

github-actions[bot] avatar Aug 01 '24 00:08 github-actions[bot]