proxy-control

Description

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

proxy-control - 图1IMPORTANT

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

Attributes

NameTypeRequiredDefaultDescription
request_bufferingbooleanFalsetrueWhen set to true, the Plugin dynamically sets the proxy_request_buffering directive.

Enabling the Plugin

The example below enables the Plugin on a specific Route:

  1. curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
  2. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  3. {
  4. "uri": "/upload",
  5. "plugins": {
  6. "proxy-control": {
  7. "request_buffering": false
  8. }
  9. },
  10. "upstream": {
  11. "type": "roundrobin",
  12. "nodes": {
  13. "127.0.0.1:1980": 1
  14. }
  15. }
  16. }'

Example usage

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

  1. 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.

Disable Plugin

To disable 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.

  1. curl -i http://127.0.0.1:9180/apisix/admin/routes/1 \
  2. -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
  3. {
  4. "uri": "/upload",
  5. "upstream": {
  6. "type": "roundrobin",
  7. "nodes": {
  8. "127.0.0.1:1980": 1
  9. }
  10. }
  11. }'