Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to response bodies in backend modifiers fails #436

Closed
alex-schneider opened this issue Feb 9, 2022 · 1 comment · Fixed by #453
Closed

Access to response bodies in backend modifiers fails #436

alex-schneider opened this issue Feb 9, 2022 · 1 comment · Fixed by #453
Labels
bug Something isn't working

Comments

@alex-schneider
Copy link
Contributor

Describe the bug
Access to response bodies (backend_responses.<label>.*body) in modifiers (like set_response_headers) does not work.

To Reproduce
Steps to reproduce the behavior:

  1. couper version: 0 2022-02-09 dev

  2. Provide your configuration file *.hcl. Remove sensitive data.

server {
  endpoint "/" {
    proxy {
      url = "https://httpbin.org/anything"

      backend {
        set_response_headers = {
          x-foo = backend_responses.default.headers.content-type # works
          x-bug = backend_responses.default.json_body.method     # does not work
        }
        custom_log_fields = {
          foo = backend_responses.default.headers.content-type # works
          bar = backend_responses.default.json_body.method     # works
        }
      }
    }
  }
}
  1. Provide a curl call for reproduction: $ curl -v localhost:8080

Expected behavior
X-Bug HTTP header field with GET value in the response.

@alex-schneider alex-schneider added the bug Something isn't working label Feb 9, 2022
@johakoch
Copy link
Collaborator

johakoch commented Mar 14, 2022

It depends on where the set_response_headers is used. With

server {
  endpoint "/" {
    proxy {
      url = "https://httpbin.org/anything"
      set_response_headers = {
        x-foo = backend_responses.default.headers.content-type
        x-bug = backend_responses.default.json_body.method
      }
    }
  }
}

or

server {
  endpoint "/" {
    set_response_headers = {
      x-foo = backend_responses.default.headers.content-type
      x-bug = backend_responses.default.json_body.method
    }
    proxy {
      url = "https://httpbin.org/anything"
    }
  }
}

both headers are set.

@malud malud changed the title Access to response bodies in modifiers fails Access to response bodies in backend modifiers fails Mar 15, 2022
@johakoch johakoch linked a pull request Mar 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants