Skip to content

Dynamic proxy? #298

Description

@Laski

I'm trying to combine the "dynamic_mock" and "proxy" resources. My objective is to route the requests wherever the HOST header says.

e.g.

request:
  method: GET
  path: /example
dynamic_response:
  engine: lua
  script: |-
    require "math"
    return {
      proxy = {
        host = ..request.headers.host,
        follow_redirects = true
      }
    }

or

request:
  method: GET
  path: /example
dynamic_response:
  engine: go_template_yaml
  script: |
    proxy:
      host: {{.Request.Headers.Get "Host"}}
      follow_redirect: true

neither of this seem to work (the response is actually 200 but empty).

Maybe I should note that hardcoding the host part doesn't seem to work either.

Is this a supported use case?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions