Skip to main content
Version: 2.13



The proxy-mirror plugin, which provides the ability to mirror client requests.

Note: The response returned by the mirror request is ignored.


hoststringrequiredSpecify a mirror service address, e.g. (address needs to contain scheme: http or https, and without the path part)
pathstringoptionalSpecify the mirror request's path part. Without it the current path will be used.
sample_rationumberoptional1[0.00001, 1]the sample ratio that requests will be mirrored.


Enable the plugin#

example 1: enable the proxy-mirror plugin for a specific route :

curl  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
"plugins": {
"proxy-mirror": {
"host": ""
"upstream": {
"nodes": {
"": 1
"type": "roundrobin"
"uri": "/hello"

Test plugin:

$ curl -i
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 12
Connection: keep-alive
Server: APISIX web server
Date: Wed, 18 Mar 2020 13:01:11 GMT
Last-Modified: Thu, 20 Feb 2020 14:21:41 GMT

hello world

Since the specified mirror address is, so to verify whether this plugin is in effect, we need to confirm on the service with port 9797. For example, we can start a simple server: python -m SimpleHTTPServer 9797

Disable Plugin#

Remove the corresponding JSON in the plugin configuration to disable the plugin immediately without restarting the service:

curl  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
"uri": "/hello",
"plugins": {},
"upstream": {
"type": "roundrobin",
"nodes": {
"": 1

The plugin has been disabled now.

Customize proxy timeouts for mirrored sub-request#

We can customize proxy timeouts for the mirrored sub-request in the plugin_attr of conf/config.yaml. This is useful while mirroring traffic to a slow backend in a long connection scenario.

connectstring60sconnect timeout to the mirrored upstream
readstring60sread timeout to the mirrored upstream
sendstring60ssend timeout to the mirrored upstream
connect: 2000ms
read: 2000ms
send: 2000ms