apache / apisix-go-plugin-runner

Go Plugin Runner for APISIX
https://apisix.apache.org/
Apache License 2.0
169 stars 69 forks source link

request help: Can a reverse proxy like proxy_pass be implemented in the Go Runner plugin? #60

Closed elricli closed 2 years ago

elricli commented 2 years ago

Issue description

我想使用 Go Runner 来实现灰度策略的插件,所以需要反向代理的功能,所以在 Go Runner 插件中可以实现吗?

Environment

shuaijinchao commented 2 years ago

Since the current Plugin Runner does not support the operation of Upstream information, it is not yet supported to develop this function on the Plugin Runner. Currently, Plugin Runner supports operations on request data such as request headers, request parameters, request body, and request URI.

spacewander commented 2 years ago

Yes. We can use Go runner to set the flag in the header & do the real job in https://apisix.apache.org/docs/apisix/plugins/traffic-split

elricli commented 2 years ago

Yes. We can use Go runner to set the flag in the header & do the real job in https://apisix.apache.org/docs/apisix/plugins/traffic-split

Thanks, But how can get host in Go Plugin Runner? Or by Host header?

I need get service name by host, Like svc1.example.com service is svc1.

elricli commented 2 years ago

@spacewander Are there best practices for traffic-split? Background: When a new grayscale publishing plan is published, an upstream is added to the route of the system involved and the traffic-split rule is configured. A grayscale release plan involves multiple systems.

traffic-split 有最佳实践吗? 背景:当发布一个新灰度发布计划,会在所涉及系统的 route 上新增一个upstream,并配置 traffic-split 规则。一个灰度发布计划会涉及多个系统路由。

spacewander commented 2 years ago

Yes. We can use Go runner to set the flag in the header & do the real job in apisix.apache.org/docs/apisix/plugins/traffic-split

Thanks, But how can get host in Go Plugin Runner? Or by Host header?

I need get service name by host, Like svc1.example.com service is svc1.

Yes, from the Host header.

elricli commented 2 years ago

Thanks. Go Plugin Runner support APISIX global rules? If can, Go Plugin Runner does not need to be enabled for each route.

spacewander commented 2 years ago

Technically possible, but it is beyond our design. Go plugin runner is only used when sometimes you can't do it with the existing plugin or Lua code.

Since the ext-plugin can be enabled on the fly, you can configure it until it's needed.

elricli commented 2 years ago

Technically possible, but it is beyond our design. Go plugin runner is only used when sometimes you can't do it with the existing plugin or Lua code.

Since the ext-plugin can be enabled on the fly, you can configure it until it's needed.

Thanks. In my scenario, since I am not familiar with Lua code, I want to use the Go Plugin Runner mechanism to implement custom plugin logic.