Hi:

love this feature too.

But I think We can refer to this implementation[1].

[1] https://github.com/apache/incubator-apisix/blob/master/bin/apisix#L416
<https://github.com/apache/incubator-apisix/blob/master/bin/apisix#L416>


On Sat, Mar 14, 2020 at 10:34 AM Ming Wen <wenm...@apache.org> wrote:

> looks good to me
>
> agile6v <agil...@apache.org>于2020年3月14日 周六上午10:33写道:
>
> > Hi all,
> >
> > Is it necessary to provide a request mirror plugin?
> >
> > The nginx configuration looks like:
> >
> > set $var_mirror_disable 1;
> >
> > location / {
> >      mirror /mirror_location;
> >      proxy_pass  $upstream_scheme://apisix_backend$upstream_uri;
> > }
> >
> > location /mirror_location {
> >     if ($var_mirror_disable) {
> >         return 200;
> >     }
> >
> >     proxy_pass $mirror_address;
> > }
> >
> > The variable `var_mirror_disable` and `mirror_address` can be configured
> > in the mirror plugin.
> >
> > The admin api looks like this:
> >
> > {
> >     "plugins": {
> >        "mirror": {
> >            "address": "127.0.0.1:8090"
> >        }
> >     },
> >     "upstream": {
> >        "nodes": {
> >            "127.0.0.1:1980": 1
> >        },
> >        "type": "roundrobin"
> >     },
> >     "uri": "/hello"
> > }
> >
> >
> > In addition, it would be better if the mirror directive could support
> > variable.
> >
> > Thanks,
> > agile6v
> >
> --
> Thanks,
> Ming Wen, Apache APISIX & Apache SkyWalking
> Twitter: _WenMing
>


-- 
*MembPhis*
My github: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix

Reply via email to