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

Dynamic proxy? #298

Open
Laski opened this issue Feb 5, 2024 · 1 comment
Open

Dynamic proxy? #298

Laski opened this issue Feb 5, 2024 · 1 comment
Labels
feature-request New feature or request

Comments

@Laski
Copy link

Laski commented Feb 5, 2024

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?

@Thiht
Copy link
Collaborator

Thiht commented Mar 19, 2024

Hi @Laski,

dynamic_responses only allow to generate a response, not a proxy.

There's no real way to handle "dynamic proxy" for now.

@Thiht Thiht added the feature-request New feature or request label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Development

No branches or pull requests

2 participants