proxy-mirror

note

The response returned by the mirror request is ignored.

You can customize the proxy timeouts for the mirrored sub-requests by configuring the plugin_attr key in your configuration file (conf/config.yaml). This can be used for mirroring traffic to a slow backend.

You can enable the Plugin on a specific Route as shown below:

  1. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  2. "plugins": {
  3. "proxy-mirror": {
  4. "host": "http://127.0.0.1:9797"
  5. }
  6. },
  7. "upstream": {
  8. "127.0.0.1:1999": 1
  9. },
  10. "type": "roundrobin"
  11. "uri": "/hello"
  12. }'

We can specify the timeout for subrequests in plugin_attr in conf/config.yaml. This is useful in connection reuse scenarios when mirroring traffic to a very slow backend service.

proxy-mirror - 图2tip

For testing you can create a test server by running:

  1. python -m http.server 9797

Once you have configured the Plugin as shown above, the requests made will be mirrored to the configured host.

  1. HTTP/1.1 200 OK
  2. hello world