0

For example, if the parameters of the plugin are configured with 1, after a period of business logic analysis, it will jump to upstream1, and if configured with 2, it will jump to 2.I try to do,but fail.It always redirect to upstream1 because my route's server config is upstream1 .

function MyPlugin:access(plugin_conf) 

kong.service.set_upstream("upstream1Name")

I know it is easy to do it in openresty config file by

proxy_pass http://$backend/myMethod

flower
  • 2,212
  • 3
  • 29
  • 44
  • Can you share what you have tried ? The shared code only show `upstream1` in `set_upstream` – Ôrel Jun 26 '23 at 06:55
  • @Orel,In my custom plugin I just want to redirect to the upstream whichi is defind and config by konga.But I find that it do not redirect .It just return reason: Bad HostPort – flower Jun 26 '23 at 12:10
  • you can try with `kong.service.set_target` to set an host instead of using an upstream. Does the upstream working well without plugin ? – Ôrel Jun 26 '23 at 14:32

0 Answers0