# 应用配置

# 获取 HTTP 应用配置

# 简介

获取 HTTP 应用配置

# URI

GET /admin-api/applications/http/{app-id}/config

# 请求示例

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

# 响应示例

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": {
            "enable": 1, // 0: use the global configuration; 1: enable; 2: disable
            "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'
        }
    }
}

# 修改 HTTP 应用配置

# 简介

修改 HTTP 应用配置

# URI

PUT /admin-api/applications/http/{app-id}/config

# JSON body 参数

{
    "enable_gzip": 0, // 0: use global config; 1: enable; 2: disable
    "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": {
        "enable": 1, // 0: use the global configuration; 1: enable; 2: disable
        "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'
    }
}

# 请求示例

# Shell
curl -X PUT \
  -H "API-Token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{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}}'

# 响应示例

Status: 200 OK
{"status":0}