Skip to content

Latest commit

 

History

History
94 lines (76 loc) · 3.2 KB

proxy-control.md

File metadata and controls

94 lines (76 loc) · 3.2 KB
title keywords description
proxy-control
Apache APISIX
API Gateway
Proxy Control
This document contains information about the Apache APISIX proxy-control Plugin, you can use it to control the behavior of the NGINX proxy dynamically.

Description

The proxy-control Plugin dynamically controls the behavior of the NGINX proxy.

:::info IMPORTANT

This Plugin requires APISIX to run on APISIX-Base. See apisix-build-tools for more info.

:::

Attributes

Name Type Required Default Description
request_buffering boolean False true When set to true, the Plugin dynamically sets the proxy_request_buffering directive.

Enable Plugin

The example below enables the Plugin on a specific Route:

curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri": "/upload",
    "plugins": {
        "proxy-control": {
            "request_buffering": false
        }
    },
    "upstream": {
        "type": "roundrobin",
        "nodes": {
            "127.0.0.1:1980": 1
        }
    }
}'

Example usage

The example below shows the use case of uploading a big file:

curl -i http://127.0.0.1:9080/upload -d @very_big_file

It's expected to not find a message "a client request body is buffered to a temporary file" in the error log.

Delete Plugin

To remove the proxy-control Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.

curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
    "uri": "/upload",
    "upstream": {
        "type": "roundrobin",
        "nodes": {
            "127.0.0.1:1980": 1
        }
    }
}'