7. 反向代理(server)接口

7.1. 获取server分页列表

Type: GET

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Description: 获取server分页列表

Query-parameters:

Parameter Type Description Required Since

current

int32

当前页数(从1开始)

true

-

limit

int32

每页数量(默认为10)

true

-

keywords

string

查询关键字

false

-

Request-example:

curl -X GET -i /api/server/getPage?current=1&limit=10&keywords=

Response-fields:

Field Type Description Since

success

boolean

请求结果

-

status

string

请求状态 200:请求成功 401:token无效 500:服务器错误

-

msg

string

错误信息

-

obj

object

返回内容

-

└─count

int64

总记录数

-

└─curr

int32

起始页(从1开始)

-

└─limit

int32

每页记录数

-

└─records

array

列表内容

-

     └─any object

object

any object.

-

Response-example:

{
  "success": true,
  "status": "",
  "msg": "",
  "obj": {
    "count": 0,
    "curr": 0,
    "limit": 0,
    "records": [
      {
        "id": "",
        "serverName": "",
        "listen": "",
        "def": 0,
        "ipv6": 0,
        "rewrite": 0,
        "rewriteListen": "",
        "ssl": 0,
        "http2": 0,
        "proxyProtocol": 0,
        "pem": "",
        "key": "",
        "proxyType": 0,
        "proxyUpstreamId": "",
        "enable": true,
        "descr": "",
        "protocols": "",
        "passwordId": "",
        "denyAllow": 0,
        "denyId": "",
        "allowId": ""
      }
    ]
  }
}

7.2. 添加或编辑server

Type: GET

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Description: 添加或编辑server

Query-parameters:

Parameter Type Description Required Since

id

string

主键

false

-

serverName

string

监听域名

false

-

listen

string

监听ip端口 (格式 ip:port或port)

false

-

def

int32

是否为默认server 0否(默认) 1是

false

-

ipv6

int32

同时监控ipv6 0否(默认) 1是

false

-

rewrite

int32

是否http跳转https 0否(默认) 1是

false

-

rewriteListen

string

http跳转https监听ip端口,默认为80 (格式 ip:port或port)

false

-

ssl

int32

是否开启ssl 0否(默认) 1是

false

-

http2

int32

是否开启http2 0否(默认) 1是(旧版写法) 2是(新版写法)

false

-

proxyProtocol

int32

是否开启proxy_protocol 0否(默认) 1是

false

-

pem

string

ssl证书pem文件路径

false

-

key

string

ssl证书key文件路径

false

-

proxyType

int32

代理类型 0:http(默认) 1:tcp 2:udp

false

-

proxyUpstreamId

string

代理upstream的id

false

-

enable

boolean

是否启用 true:启用(默认) false:禁用

false

-

descr

string

描述

false

-

protocols

string

加密协议 (默认:TLSv1 TLSv1.1 TLSv1.2 TLSv1.3)

false

-

passwordId

string

使用的password文件Id

false

-

denyAllow

int32

IP黑白名单模式, 0:正常模式 1:黑名单模式 2:白名单模式 3:黑白名单模式

false

-

denyId

string

黑名单id

false

-

allowId

string

白名单id

false

-

Request-example:

curl -X GET -i /api/server/insertOrUpdate?def=0&ipv6=0&rewrite=0&ssl=0&http2=0&proxyProtocol=0&proxyType=0&enable=true&denyAllow=0&serverName=&key=&rewriteListen=&allowId=&listen=&passwordId=&id=&descr=&protocols=&proxyUpstreamId=&denyId=&pem=

Response-fields:

Field Type Description Since

success

boolean

请求结果

-

status

string

请求状态 200:请求成功 401:token无效 500:服务器错误

-

msg

string

错误信息

-

obj

object

返回内容

-

Response-example:

{
  "success": true,
  "status": "",
  "msg": "",
  "obj": {}
}

7.3. 删除server

Type: GET

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Description: 删除server

Query-parameters:

Parameter Type Description Required Since

id

string

反向代理id

false

-

Request-example:

curl -X GET -i /api/server/delete?id=

Response-fields:

Field Type Description Since

success

boolean

请求结果

-

status

string

请求状态 200:请求成功 401:token无效 500:服务器错误

-

msg

string

错误信息

-

obj

object

返回内容

-

Response-example:

{
  "success": true,
  "status": "",
  "msg": "",
  "obj": {}
}

7.4. 根据serverId获取location列表

Type: GET

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Description: 根据serverId获取location列表

Query-parameters:

Parameter Type Description Required Since

serverId

string

反向代理id

false

-

Request-example:

curl -X GET -i /api/server/getLocationByServerId?serverId=

Response-fields:

Field Type Description Since

success

boolean

请求结果

-

status

string

请求状态 200:请求成功 401:token无效 500:服务器错误

-

msg

string

错误信息

-

obj

array

返回内容

-

└─id

string

主键

-

└─serverId

string

所属反向代理serverId

-

└─path

string

监控路径 例:/

-

└─type

int32

代理类型 0:动态代理(默认) 1:静态代理 2:负载均衡 3:空白代理 4:重定向

-

└─returnUrl

string

重定向路径

-

└─returnPath

int32

重定向是否携带源路径 0否 1是(默认)

-

└─value

string

动态代理目标 (例:http://10.10.10.1:8080/)

-

└─upstreamType

string

代理负载协议,http or https

-

└─upstreamId

string

代理负载均衡upstream的id

-

└─upstreamPath

string

代理负载额外路径,默认为空

-

└─rootPath

string

静态代理路径 (例:/home/www)

-

└─rootPage

string

静态代理默认页面 (例:index.html)

-

└─rootType

string

静态代理类型 root:根路径模式 alias:别名模式

-

└─header

int32

是否携带Host参数 0否 1是(默认)

-

└─headerHost

string

Host参数类型 $host(默认) $http_host $host:$proxy_port $host:$server_port

-

└─websocket

int32

是否开启websocket支持 0否(默认) 1是

-

└─cros

int32

是否开启跨域支持 0否(默认) 1是

-

└─descr

string

描述

-

Response-example:

{
  "success": true,
  "status": "",
  "msg": "",
  "obj": [
    {
      "id": "",
      "serverId": "",
      "path": "",
      "type": 0,
      "returnUrl": "",
      "returnPath": 0,
      "value": "",
      "upstreamType": "",
      "upstreamId": "",
      "upstreamPath": "",
      "rootPath": "",
      "rootPage": "",
      "rootType": "",
      "header": 0,
      "headerHost": "",
      "websocket": 0,
      "cros": 0,
      "descr": ""
    }
  ]
}

7.5. 添加或编辑location

Type: GET

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Description: 添加或编辑location

Query-parameters:

Parameter Type Description Required Since

id

string

主键

false

-

serverId

string

所属反向代理serverId

false

-

path

string

监控路径 例:/

false

-

type

int32

代理类型 0:动态代理(默认) 1:静态代理 2:负载均衡 3:空白代理 4:重定向

false

-

returnUrl

string

重定向路径

false

-

returnPath

int32

重定向是否携带源路径 0否 1是(默认)

false

-

value

string

动态代理目标 (例:http://10.10.10.1:8080/)

false

-

upstreamType

string

代理负载协议,http or https

false

-

upstreamId

string

代理负载均衡upstream的id

false

-

upstreamPath

string

代理负载额外路径,默认为空

false

-

rootPath

string

静态代理路径 (例:/home/www)

false

-

rootPage

string

静态代理默认页面 (例:index.html)

false

-

rootType

string

静态代理类型 root:根路径模式 alias:别名模式

false

-

header

int32

是否携带Host参数 0否 1是(默认)

false

-

headerHost

string

Host参数类型 $host(默认) $http_host $host:$proxy_port $host:$server_port

false

-

websocket

int32

是否开启websocket支持 0否(默认) 1是

false

-

cros

int32

是否开启跨域支持 0否(默认) 1是

false

-

descr

string

描述

false

-

Request-example:

curl -X GET -i /api/server/insertOrUpdateLocation?type=0&returnPath=0&header=0&websocket=0&cros=0&upstreamId=&upstreamPath=&id=&descr=&value=&path=&serverId=&upstreamType=&rootPath=&rootPage=&headerHost=&returnUrl=&rootType=

Response-fields:

Field Type Description Since

success

boolean

请求结果

-

status

string

请求状态 200:请求成功 401:token无效 500:服务器错误

-

msg

string

错误信息

-

obj

object

返回内容

-

Response-example:

{
  "success": true,
  "status": "",
  "msg": "",
  "obj": {}
}

7.6. 删除location

Type: GET

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

Description: 删除location

Query-parameters:

Parameter Type Description Required Since

id

string

代理目标location的id

false

-

Request-example:

curl -X GET -i /api/server/deleteLocation?id=

Response-fields:

Field Type Description Since

success

boolean

请求结果

-

status

string

请求状态 200:请求成功 401:token无效 500:服务器错误

-

msg

string

错误信息

-

obj

object

返回内容

-

Response-example:

{
  "success": true,
  "status": "",
  "msg": "",
  "obj": {}
}