App Configuration

Get the HTTP application configuration

Description

Get the HTTP application configuration

URI

GET /admin-api/applications/http/{app_id}/config

Example Request

Shell

curl \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/applications/http/1/config

Example Response

Status: 200 OK
{
    "status": 0,
    "data": {
        "limiter": {
            "check_post_args_type": true,
            "max_uri_args": 100,
            "max_req_headers": 100,
            "max_post_args": 120
        },
        "enable_websocket": false,
        "enable_gzip": 0, // 0: use global gzip config; 1: enable app gzip config; 2: disable app gzip config
        "proxy_cache_revalidate": 0, // 0: use global config; 1: enable; 2: disable
        "client_max_body_size": 100,
        "client_max_body_size_unit": "m", // unit: k/m
        "proxy_cache_use_stale": ["error", "timeout", "invalid_header", "updating", "http_500", "http_502", "http_503", "http_504", "http_403", "http_404", "http_429"],
        "access_log": {
            "filename": "access.log",
            "format": 1
        },
        "proxy_recursion": {
            "override_by_global": false, // If the value is true, the configuration will be overridden by the global configuration
            "enable": true, // If the value is true, max proxy recursive detection will be turned on
            "max_depth": 10 // max proxy recursive depth of a request, exceeding this will be reported with an error and a response of '502 Bad Gateway'
        }
    }
}

Updating HTTP Application Configuration

Description

Updating HTTP Application Configuration

URI

PUT /admin-api/applications/http/{app_id}/config

JSON Body Parameters

{
    "enable_gzip": 0, // 0: use global config; 1: enable; 2: disable
    "enable_brotli": 0, // 0: use global config; 1: enable; 2: disable
    "gzip_types": ["text/html", "text/plain"],
    "brotli_types": ["text/html", "text/plain"],
    "enable_websocket": false,
    "proxy_cache_revalidate": 0, // 0: use global config; 1: enable; 2: disable
    "client_max_body_size": 100,
    "client_max_body_size_unit": "m", // unit: k/m
    "proxy_cache_use_stale": ["error", "timeout", "invalid_header", "updating", "http_500", "http_502", "http_503", "http_504", "http_403", "http_404", "http_429"],
    "limiter": {
        "check_post_args_type": true,
        "max_uri_args": 100,
        "max_post_args": 100,
        "max_req_headers": 100
    },
    "access_log": {
        "format": 1, // format id from global log format
        "filename": "access.log"
    },
    "proxy_recursion": {
        "override_by_global": false, // If the value is true, the configuration will be overridden by the global configuration
        "enable": true, // If the value is true, max proxy recursive detection will be turned on
        "max_depth": 10 // max proxy recursive depth of a request, exceeding that will be reported with an error and a response of '502 Bad Gateway'
    }
}

Example Request

Shell

curl -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  https://{admin-site}/admin-api/applications/http/1/config \
  -d '{"limiter":{"check_post_args_type":true,"max_uri_args":100,"max_req_headers":100,"max_post_args":100},"enable_websocket":false,"enable_gzip":0,"access_log":{"filename":"access.log","format":1}}'

Example Response

Status: 200 OK
{"status":0}